]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)
authorVictor Stinner <vstinner@python.org>
Mon, 19 Jun 2023 22:55:23 +0000 (00:55 +0200)
committerGitHub <noreply@github.com>
Mon, 19 Jun 2023 22:55:23 +0000 (00:55 +0200)
commita5c2ad0c3d23d2b1e61ab8e0d7ee64f7e1288547
treebe5628b6a936b27c41b6343d9ceacafeac934ff8
parent33f0a8578b729e67c482daedc2660648afd0ee78
gh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)

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.
Python/pythonrun.c