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.

Author pitrou
Recipients brett.cannon, ncoghlan, neologix, pitrou, python-dev, r.david.murray, vstinner
Date 2011-11-13.01:20:49
SpamBayes Score 1.756475e-10
Marked as misclassified No
Message-id <1321147252.88.0.159545157159.issue13392@psf.upfronthosting.co.za>
In-reply-to
Content
#13146 solved the issue of writing pyc files under POSIX. Under Windows, the problem still exists, as the following buildbot failure shows:

[317/360] test_multiprocessing
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py", line 373, in main
    prepare(preparation_data)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py", line 499, in prepare
    '__parents_main__', file, path_name, etc
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\regrtest.py", line 175, in <module>
    import packaging.command
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\command\__init__.py", line 4, in <module>
    from packaging.util import resolve_name
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\util.py", line 5, in <module>
    import csv
EOFError: EOF read where not expected
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py", line 373, in main
    prepare(preparation_data)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\forking.py", line 499, in prepare
    '__parents_main__', file, path_name, etc
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\regrtest.py", line 175, in <module>
    import packaging.command
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\command\__init__.py", line 4, in <module>
    from packaging.util import resolve_name
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\packaging\util.py", line 5, in <module>
    import csv
EOFError: EOF read where not expected
[etc.]

(from http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/5551/steps/test/logs/stdio)

Attached patch uses MoveFileEx to perform a (hopefully atomic) rename from a temporary file when creating the pyc file.
The same strategy cannot be created for importlib since MoveFileEx isn't exposed at the Python level (we could delete the tmp file if renaming fails, though; it simply means another process beat us to it, which shouldn't be a problem here).
History
Date User Action Args
2011-11-13 01:20:53pitrousetrecipients: + pitrou, brett.cannon, ncoghlan, vstinner, r.david.murray, neologix, python-dev
2011-11-13 01:20:52pitrousetmessageid: <1321147252.88.0.159545157159.issue13392@psf.upfronthosting.co.za>
2011-11-13 01:20:52pitroulinkissue13392 messages
2011-11-13 01:20:51pitroucreate