Issue 22006: thread module documentation erroneously(?) states not all built-in functions that do blocking I/O release the GIL (original) (raw)

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:06 admin set github: 66205
2014-07-19 20:48:49 mark.dickinson set status: open -> closedversions: - Python 3.3messages: + resolution: fixedstage: needs patch -> resolved
2014-07-19 20:47:35 python-dev set messages: +
2014-07-19 20:46:09 python-dev set nosy: + python-devmessages: +
2014-07-19 19:53:06 gvanrossum set messages: +
2014-07-19 14:46:40 pitrou set nosy: + pitroumessages: +
2014-07-19 07:47:26 mark.dickinson set stage: needs patch
2014-07-19 07:46:37 mark.dickinson set nosy: + mark.dickinson, gvanrossummessages: + versions: - Python 3.1, Python 3.2
2014-07-18 19:55:53 dan.oreilly set title: 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:27 dan.oreilly create