homepage

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: pyflakes: undefined names, get_context() and main(), in multiprocessing
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: sbt Nosy List: jnoller, python-dev, sbt, serhiy.storchaka, vstinner
Priority: normal Keywords:

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 (msg214136):
"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:00adminsetgithub: 65189
2014年03月25日 21:47:19sbtsetstatus: open -> closed
type: behavior
messages: + msg214855

resolution: fixed
stage: resolved
2014年03月24日 21:30:41vstinnersetmessages: + msg214732
2014年03月23日 18:55:19python-devsetmessages: + msg214626
2014年03月23日 13:16:51vstinnersetmessages: + msg214575
2014年03月23日 11:59:22python-devsetnosy: + python-dev
messages: + msg214563
2014年03月20日 20:24:21sbtsetassignee: sbt
2014年03月20日 08:35:24serhiy.storchakasetmessages: + msg214190
2014年03月20日 08:02:35vstinnersetmessages: + msg214183
2014年03月20日 08:00:03vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /