Issue 5298: Inconsistency in C-API thread docs (original) (raw)

The language in the threading API documentation is a little inconsistent. The section I'm talking about is here: http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock

The GIL is variously referred to as "global lock", "interpreter lock", "global interpreter lock", "GIL", and simply "the lock". Given the infamy of the GIL, one might expect all of these to be equally clear. But as someone coding to this API for the first time, I had plenty to learn already and the need to ensure that all of these referred to the same singleton was distracting.

This documentation begins, "The Python interpreter is not fully thread safe. In order to support multi-threaded Python programs, there's a global lock that must be held by the current thread before it can safely access Python objects. Without the lock..."

My suggestion is to alter the second sentence to the following: "Without this lock (called the global interpreter lock, or GIL for short)...."

All subsequent documentation references to "interpreter lock", "global interpreter lock", and "lock" should be changed to "GIL". It would be nice if the API referred to it consistently (e.g. PyEval_AcquireLock() versus PyGILState_Ensure()) but that would require an interface change which is obviously out of the question.