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

gh-105922: Refactor PyRun_InteractiveOneObjectEx() #105925

Merged
merged 1 commit into from Jun 19, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 19, 2023

Refactor PyRun_InteractiveOneObjectEx(), _PyRun_SimpleFileObject() and PyRun_SimpleStringFlags():

  • Keep a strong reference to the main module while using its dictionary (PyModule_GetDict()). Use PyImport_AddModule() with Py_XNewRef().
  • Declare variables closer to where they are defined.
  • Rename variables to use name longer than 1 character.
  • Add pyrun_one_parse_ast() sub-function.

Refactor PyRun_InteractiveOneObjectEx(), _PyRun_SimpleFileObject()
and PyRun_SimpleStringFlags():

* Keep a strong reference to the __main__ module while using its
  dictionary (PyModule_GetDict()). Use PyImport_AddModule() with
  Py_XNewRef().
* Declare variables closer to where they are defined.
* Rename variables to use name longer than 1 character.
* Add pyrun_one_parse_ast() sub-function.
@vstinner vstinner merged commit a5c2ad0 into python:main Jun 19, 2023
21 checks passed
@vstinner vstinner deleted the pythonrun branch June 19, 2023 22:55
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

2 participants