Skip to content

bpo-34170: Fix pymain_run_file()#8660

Merged
vstinner merged 1 commit intopython:masterfrom
vstinner:pymain_run_file
Aug 3, 2018
Merged

bpo-34170: Fix pymain_run_file()#8660
vstinner merged 1 commit intopython:masterfrom
vstinner:pymain_run_file

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Aug 3, 2018

bpo-34170, bpo-34326: Fix pymain_run_file(): use
PyRun_AnyFileExFlags(closeit=1) instead of calling fclose(fp)
explicitly to close the input file before running the code.

https://bugs.python.org/issue34170

bpo-34170, bpo-34326: Fix pymain_run_file(): use
PyRun_AnyFileExFlags(closeit=1) instead of calling fclose(fp)
explicitly to close the input file before running the code.
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner merged commit d807862 into python:master Aug 3, 2018
@vstinner vstinner deleted the pymain_run_file branch August 3, 2018 21:54
@vstinner
Copy link
Member Author

vstinner commented Aug 3, 2018

Thanks for the review @pablogsal!

@matrixise
Copy link
Member

:/ I didn't find it but I was thinking about this function.

@pablogsal
Copy link
Member

@matrixise I am afraid that nothing on earth is faster than @vstinner, not even unladen swallows!

@vstinner
Copy link
Member Author

vstinner commented Aug 3, 2018

@matrixise I am afraid that nothing on earth is faster than @vstinner, not even unladen swallows!

African or european?

@vstinner
Copy link
Member Author

vstinner commented Aug 3, 2018

@matrixise I am afraid that nothing on earth is faster than @vstinner, not even unladen swallows!

More seriously, I knew that I modifed PyRun_AnyFileExFlags() to change when the file is closed. But the full test passed on Linux. It seems like it only failed on specific platforms. Strange. It might be related to os.urandom() private FD, I don't know.

I also noticed that test_subprocess failed on VSTS: macOS, before I merged my PR (the one which introduced the fix), but I don't trust VSTS since this CI has many random failures.

Note: FYI I wrote this fix in my car. But no, I wasn't driving hopefully ;-) I'm now in holiday, see you back in a few weeks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants