-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to solve race-condition which corrupts .pyc files on Windows #3390
Attempt to solve race-condition which corrupts .pyc files on Windows #3390
Conversation
749c634
to
9727e01
Compare
9727e01
to
4dca5a4
Compare
size = source_stat.size & 0xFFFFFFFF | ||
fp.write(struct.pack("<ll", mtime, size)) | ||
if six.PY2: | ||
marshal.dump(co, fp.file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that bit looks strange why is that kind of access needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails on PY2 because fp
is not a real file object, it is a _TemporaryFile
(or something like that). In PY3 just passing fp
to marshal.dump
works.
It is probably possible to use marshal.dump(co, fp.file)
in both Python 2 and 3, but I prefer to separate those cases so when the time comes around to drop Python 2 it is clear that we can keep the "cleaner" version.
@nicoddemus please rebase, then i'll merge ^^ |
This uses of the `atomicwrites` library. This is very hard to create a reliable test for. Fix pytest-dev#3008
4dca5a4
to
aa95a42
Compare
Rebased, thanks @RonnyPfannschmidt! |
This uses of the
atomicwrites
library.This is very hard to create a reliable test for.
Fix #3008