Skip to content

gh-105922: Refactor PyRun_InteractiveOneObjectEx() #105925

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
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.
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.

2 participants