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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105922: Add PyImport_AddModuleRef() function #105923

Merged
merged 1 commit into from Jun 20, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 19, 2023

  • Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
    PyImport_AddModuleObject().
  • pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
    PyImport_AddModuleRef(name).

馃摎 Documentation preview 馃摎: https://cpython-previews--105923.org.readthedocs.build/

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Nice; I left some comments.

Too bad we cannot run the ref leak bots now; there's already a ref leak in test_import and test_peg_generator that has not been resolved :(

Include/import.h Show resolved Hide resolved
Python/import.c Outdated Show resolved Hide resolved
Python/import.c Outdated Show resolved Hide resolved
Python/pythonrun.c Outdated Show resolved Hide resolved
@vstinner
Copy link
Member Author

I updated my PR:

  • Rebased on the merged pythonrunc.c refactoring: commit a5c2ad0
  • Don't deprecate PyImport_AddModule() and PyImport_AddModuleObject() in this PR anymore: I prefer to handle this in a separated PR.
  • Fix pythonrun.c
  • Use PyImport_AddModuleRef() for _frozen_importlib

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Small typo nit. Otherwise looks good to me.

Doc/whatsnew/3.13.rst Outdated Show resolved Hide resolved
* Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
  PyImport_AddModuleObject().
* pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
  PyImport_AddModuleRef(name).
@vstinner
Copy link
Member Author

I fixed the typo: similar than => similar to.

@vstinner vstinner merged commit 03f1a13 into python:main Jun 20, 2023
21 checks passed
@vstinner vstinner deleted the pyimport_addmoduleref branch June 20, 2023 06:48
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.

None yet

3 participants