Skip to content

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

2 participants