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 neologix
Recipients brett.cannon, ncoghlan, neologix, pitrou, r.david.murray, vstinner
Date 2011-10-12.16:37:57
SpamBayes Score 2.05959e-11
Marked as misclassified No
Message-id <>
> Here is a patch for import.c.

Looks good to me.

> This new patch also fixes importlib.

                path_tmp = path + '.tmp'
                with _io.FileIO(path_tmp, 'wb') as file:
                _os.rename(path_tmp, path)

I don't know exactly the context in which this code runs, but you can have a corruption if multiple processes try to write the bytecode file at the same time, since they'll all open the .tmp file: it should be opened with O_EXCL.

Also, as a side note, I'm wondering whether this type of check:
            if not sys.platform.startswith('win'):
                # On POSIX-like platforms, renaming is atomic

couldn't be rewritten as
            if == 'posix':
                # On POSIX-like platforms, renaming is atomic

Fox example, does OS-X report as POSIX?
Date User Action Args
2011-10-12 16:37:58neologixsetrecipients: + neologix, brett.cannon, ncoghlan, pitrou, vstinner, r.david.murray
2011-10-12 16:37:58neologixsetmessageid: <>
2011-10-12 16:37:57neologixlinkissue13146 messages
2011-10-12 16:37:57neologixcreate