Skip to content
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

bpo-32381: pymain_run_command() uses PyCF_IGNORE_COOKIE #23724

Merged
merged 2 commits into from Dec 23, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Dec 9, 2020

Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE
compiler flag to the parser.

And pymain_run_python() no longer propage compiler flags between
function calls.

https://bugs.python.org/issue32381

The coding cookie (ex: "# coding: latin1") is now ignored in the
command passed to the -c command line option.

Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE
compiler flag to the parser.

pymain_run_python() no longer propages compiler flags between
function calls.
@vstinner
Copy link
Member Author

vstinner commented Dec 15, 2020

I added an unit test for the ignored coding cookie.

@lysnikolaou @pablogsal: Would you mind to review this change? Do you see any reason to propagate the compiler flags between functions calls? My expectation is that the original author didn't know how to pass compiler flags to PyRun functions, and so passed the same "cf" pointer all around, just to make PyRun functions happy.

@vstinner
Copy link
Member Author

vstinner commented Dec 16, 2020

cc @isidentical

@vstinner vstinner merged commit a124916 into python:master Dec 23, 2020
3 checks passed
@vstinner vstinner deleted the compiler_flags branch Dec 23, 2020
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
The coding cookie (ex: "# coding: latin1") is now ignored in the
command passed to the -c command line option.

Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE
compiler flag to the parser.

pymain_run_python() no longer propages compiler flags between
function calls.
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.

None yet

3 participants