This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: thread module documentation erroneously(?) states not all built-in functions that do blocking I/O release the GIL
Type: Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: dan.oreilly, docs@python, gvanrossum, mark.dickinson, pitrou, python-dev
Priority: normal Keywords:

Created on 2014-07-18 19:53 by dan.oreilly, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (7)
msg223428 - (view) Author: Dan O'Reilly (dan.oreilly) * Date: 2014-07-18 19:53
Currently, the caveats section of the thread/_thread module has this statement in it:

"Not all built-in functions that may block waiting for I/O allow other threads to run. (The most popular ones (time.sleep(), file.read(), select.select()) work as expected.)"

As far as I know, this isn't the case; all built-in functions that do blocking I/O release the GIL, and therefore do indeed allow other threads to run.

I asked a question about this on stackoverflow recently (http://stackoverflow.com/q/24831458/2073595), and Mark Dickinson helpfully pointed out that this statement was added by Guido way back in 1994, which suggests it's probably just obsolete. If that's the case, the statement should be removed to avoid confusion.
msg223462 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-07-19 07:46
It seems likely that this information is just out of date.  But even if there *are* still built-in functions lurking somewhere that don't release the GIL during I/O, the statement in the docs isn't really helpful in finding them.  Either way, I'd recommend simply removing it.

Adding Guido to the nosy in case he can provide a pre-Python 1.0 historical perspective.
msg223465 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-07-19 14:46
It all depends what you call "I/O". What is true is that not all functions doing system calls release the GIL, AFAIR. If you mean I/O as in actual disk or network I/O then yes, all such functions whould release the GIL.

That said, I agree that the statement isn't very helpful.
msg223471 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-07-19 19:53
Not in my wildest dreams could I have expected that that claim would still be in the docs 20 years later. :-)  Please get rid of it.
msg223476 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-19 20:46
New changeset 855ff9182a07 by Mark Dickinson in branch '3.4':
Issue #22006: Remove outdated _thread caveat.  Thanks Dan O'Reilly for the report.
http://hg.python.org/cpython/rev/855ff9182a07

New changeset 3b6b905ae229 by Mark Dickinson in branch 'default':
Issue #22006: Merge from 3.4.
http://hg.python.org/cpython/rev/3b6b905ae229
msg223477 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-19 20:47
New changeset 4f359c631bb0 by Mark Dickinson in branch '2.7':
Issue #22006: Remove outdated thread module caveat.  Thanks Dan O'Reilly for the report.
http://hg.python.org/cpython/rev/4f359c631bb0
msg223478 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-07-19 20:48
It's gone.
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66205
2014-07-19 20:48:49mark.dickinsonsetstatus: open -> closed
versions: - Python 3.3
messages: + msg223478

resolution: fixed
stage: needs patch -> resolved
2014-07-19 20:47:35python-devsetmessages: + msg223477
2014-07-19 20:46:09python-devsetnosy: + python-dev
messages: + msg223476
2014-07-19 19:53:06gvanrossumsetmessages: + msg223471
2014-07-19 14:46:40pitrousetnosy: + pitrou
messages: + msg223465
2014-07-19 07:47:26mark.dickinsonsetstage: needs patch
2014-07-19 07:46:37mark.dickinsonsetnosy: + mark.dickinson, gvanrossum

messages: + msg223462
versions: - Python 3.1, Python 3.2
2014-07-18 19:55:53dan.oreillysettitle: thread module documentation erroneously(?) states not all built-in functions release the GIL -> thread module documentation erroneously(?) states not all built-in functions that do blocking I/O release the GIL
2014-07-18 19:53:27dan.oreillycreate