FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-140550: allow slots that repeat information from PyModuleDef by encukou · Pull Request #144340 · python/cpython · GitHub

/ cpython Public

gh-140550: allow slots that repeat information from PyModuleDef - #144340

Merged
encukou merged 4 commits into
python:mainfrom
encukou:slotparrot
Feb 9, 2026
Merged

gh-140550: allow slots that repeat information from PyModuleDef#144340
encukou merged 4 commits into
python:mainfrom
encukou:slotparrot

Conversation

encukou commented Jan 30, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

From feedback on the discussion thread:

When integrating slots-based module creation is with the inittab, which currently requires PyModuleDef, it would be convenient to reuse the the same slots array for the MethodDef.

This PR allows slots that match what's already present in the PyModuleDef.

cc @ngoldbaum


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

When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.

ngoldbaum commented Jan 30, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

I can confirm that with this PR the PyO3 tests all pass on my for-petr branch, which uses the same slots array for both initialization hooks and unconditionally sets m_name and m_doc in PyModuleDef. It's fine for PyO3's purposes to have duplicate information with this check to make sure that the duplicate information matches exactly.

Comment thread Doc/c-api/module.rst Outdated
Comment thread Objects/moduleobject.c Outdated
Comment thread Doc/c-api/module.rst

Copy link
Copy Markdown
Contributor

Hi all - it'd be nice to have this merged by next week so this can be in 3.15a6 due out on Feb 10th. It'd be nice to not have the workaround for the old behavior committed to PyO3, see PyO3/pyo3#5753 (comment).

encukou merged commit b22ff1e into python:main Feb 9, 2026
47 checks passed
encukou deleted the slotparrot branch February 9, 2026 10:35
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…pythonGH-144340)

When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…pythonGH-144340)

When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL