Skip to content

bpo-32381: Fix PyRun_SimpleFileExFlags() encoding #23642

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

Merged
merged 1 commit into from
Dec 8, 2020
Merged

bpo-32381: Fix PyRun_SimpleFileExFlags() encoding #23642

merged 1 commit into from
Dec 8, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Dec 4, 2020

Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

  • Add pyrun_file() subfunction.
  • Add pyrun_simple_file() subfunction.
  • PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
    _Py_fopen().

https://bugs.python.org/issue32381

@vstinner
Copy link
Member Author

vstinner commented Dec 4, 2020

@FFY00: Hey, the "Check if generated files are up to date" worked as expected! It spotted a bug in my PR (already fixed):

Check that libpython3.10d.a only exports symbols starting with Py or _Py
+ nm --no-sort libpython3.10d.a
Ignore 20161 local symbols

Smelly symbol: pyrun_simple_file (type: T)

ERROR: Found 1 smelly symbols!

Thanks again for this nice new GitHub Action job ;-)

ret = NULL;
}

if (arena != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

arena can't be NULL here anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, fixed, thanks ;-)

Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
  _Py_fopen().
@vstinner
Copy link
Member Author

vstinner commented Dec 4, 2020

Strange. I pushed a fix for if (arena != NULL) but I cannot see yet. I guess that it will appear on the website soon.

@vstinner vstinner merged commit b6d98c1 into python:master Dec 8, 2020
@vstinner vstinner deleted the pyrun_file branch December 8, 2020 13:38
vstinner added a commit that referenced this pull request Dec 8, 2020
Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
  _Py_fopen().

(cherry picked from commit b6d98c1)
vstinner added a commit that referenced this pull request Dec 8, 2020
… (GH-23696)

Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
  _Py_fopen().

(cherry picked from commit b6d98c1)
(cherry picked from commit f0e42ae)
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
  _Py_fopen().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants