GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-105922: Add PyImport_AddModuleRef() function by vstinner · Pull Request #105923 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 19, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
    PyImport_AddModuleObject().
  • pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
    PyImport_AddModuleRef(name).
  • Issue: C API: Add PyImport_AddModuleRef() function #105922

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner requested review from a team, brettcannon, encukou, ericsnowcurrently, ncoghlan and warsaw as code owners June 19, 2023 18:03
@bedevere-bot bedevere-bot added the awaiting core review label Jun 19, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jun 19, 2023
C API: Add PyImport_AddModuleRef() function #105922
Closed
erlend-aasland
erlend-aasland reviewed Jun 19, 2023
View reviewed changes

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 :(

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Include/import.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/C API/2023-06-19-20-02-16.gh-issue-105922.o4T6wO.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/import.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/import.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Python/pythonrun.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner force-pushed the pyimport_addmoduleref branch from 631c02c to bf2a756 Compare June 19, 2023 23:08
@vstinner

vstinner commented Jun 19, 2023

Copy link
Copy Markdown
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
erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland approved these changes Jun 19, 2023
View reviewed changes

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/C API/2023-06-19-20-02-16.gh-issue-105922.o4T6wO.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 19, 2023
@vstinner
pythongh-105922: Add PyImport_AddModuleRef() function
f3a223d
* Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
  PyImport_AddModuleObject().
* pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
  PyImport_AddModuleRef(name).
@vstinner

vstinner commented Jun 20, 2023

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner force-pushed the pyimport_addmoduleref branch from 22c5f8c to f3a223d Compare June 20, 2023 00:36
@vstinner
vstinner merged commit 03f1a13 into python:main Jun 20, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jun 20, 2023
@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

Reviewers

@erlend-aasland erlend-aasland erlend-aasland approved these changes
@encukou encukou Awaiting requested review from encukou encukou is a code owner
@brettcannon brettcannon Awaiting requested review from brettcannon brettcannon is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @erlend-aasland @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.