Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-157384: Set package context in PyImport_CreateModuleFromInitfunc() - #157387

Open
itamaro wants to merge 1 commit into
python:mainfrom
itamaro:gh-116146-initfunc-pkgcontext
Open

gh-157384: Set package context in PyImport_CreateModuleFromInitfunc()#157387
itamaro wants to merge 1 commit into
python:mainfrom
itamaro:gh-116146-initfunc-pkgcontext

Conversation

@itamaro

@itamaro itamaro commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

A single-phase init function that creates its module using only the last component of a dotted name (as pybind11 does for submodules) got a module whose name was the short name. Set the package context while calling the init function, as the dynamic loader does, so the module gets the full name from the spec.

AI assisted with Claude Fable 5.1

…func()

A single-phase init function that creates its module using only the
last component of a dotted name (as pybind11 does for submodules) got
a module whose __name__ was the short name.  Set the package context
while calling the init function, as the dynamic loader does, so the
module gets the full name from the spec.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HoZE3WdRWQshvinfBZ137N
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34530612 | 📁 Comparing 238cdb7 against main (2cd6d4b)

  🔍 Preview build  

2 files changed
± c-api/import.html
± whatsnew/changelog.html

@itamaro itamaro added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant