Issue 20990: pyflakes: undefined names, get_context() and main(), in multiprocessing (original) (raw)

Created on 2014-03-20 08:00 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (8)
msg214182 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-03-20 08:00
Two warnings from pyflakes: diff -r 72889bf8531d Lib/multiprocessing/spawn.py --- a/Lib/multiprocessing/spawn.py Tue Mar 18 13:21:29 2014 +0100 +++ b/Lib/multiprocessing/spawn.py Wed Mar 19 11:49:24 2014 +0100 @@ -64,6 +64,7 @@ def freeze_support(): Run code for process object if this in not the main process ''' if is_forking(sys.argv): + # FIXME: main() is undefined main() sys.exit() diff -r 72889bf8531d Lib/multiprocessing/synchronize.py --- a/Lib/multiprocessing/synchronize.py Tue Mar 18 13:21:29 2014 +0100 +++ b/Lib/multiprocessing/synchronize.py Wed Mar 19 11:50:50 2014 +0100 @@ -51,7 +51,6 @@ class SemLock(object): _rand = tempfile._RandomNameSequence() def __init__(self, kind, value, maxvalue, *, ctx): - ctx = ctx or get_context() ctx = ctx.get_context() unlink_now = sys.platform == 'win32' or ctx._name == 'fork' for i in range(100):
msg214183 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-03-20 08:02
Serhiy suggested (): "Lib/multiprocessing/synchronize.py: Add at the start of the file: from . import get_context" It looks like multiprocessing.get_context() exists, but I don't see how it is defined. For main(), it should maybe be replaced with _main()?
msg214190 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-03-20 08:35
> It looks like multiprocessing.get_context() exists, but I don't see how it > is defined. It is defined by: globals().update((name, getattr(context._default_context, name)) for name in context._default_context.__all__) > For main(), it should maybe be replaced with _main()? _main() has different signature.
msg214563 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-23 11:59
New changeset 619331c67638 by Richard Oudkerk in branch '3.4': Issue #20990: Fix issues found by pyflakes for multiprocessing. http://hg.python.org/cpython/rev/619331c67638
msg214575 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-03-23 13:16
Would it be possible to write a test? Le dimanche 23 mars 2014, Roundup Robot <report@bugs.python.org> a écrit : > > Roundup Robot added the comment: > > New changeset 619331c67638 by Richard Oudkerk in branch '3.4': > Issue #20990: Fix issues found by pyflakes for multiprocessing. > http://hg.python.org/cpython/rev/619331c67638 > > ---------- > nosy: +python-dev > > _______________________________________ > Python tracker <report@bugs.python.org javascript:;> > <http://bugs.python.org/issue20990> > _______________________________________ >
msg214626 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-23 18:55
New changeset bb6377db0a9e by Richard Oudkerk in branch '3.4': Issue #20990: Correction for 619331c67638. http://hg.python.org/cpython/rev/bb6377db0a9e
msg214732 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-03-24 21:30
Can we close this issue? Or Richard wants to write a test?
msg214855 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2014-03-25 21:47
Testing the is_forking() requires cx_freeze or something similar, so it really cannot go in the test suite. I have tested it manually (after spending too long trying to get cx_freeze to work with a source build). It should be noted that on Unix freezing is currently only compatible with the default 'fork' start method.
History
Date User Action Args
2022-04-11 14:58:00 admin set github: 65189
2014-03-25 21:47:19 sbt set status: open -> closedtype: behaviormessages: + resolution: fixedstage: resolved
2014-03-24 21:30:41 vstinner set messages: +
2014-03-23 18:55:19 python-dev set messages: +
2014-03-23 13:16:51 vstinner set messages: +
2014-03-23 11:59:22 python-dev set nosy: + python-devmessages: +
2014-03-20 20:24:21 sbt set assignee: sbt
2014-03-20 08:35:24 serhiy.storchaka set messages: +
2014-03-20 08:02:35 vstinner set messages: +
2014-03-20 08:00:03 vstinner create