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-140550: allow slots that repeat information from PyModuleDef by encukou · Pull Request #144340 · python/cpython

Conversation

@encukou

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

Uh oh!

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

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

  • Issue: Implement PEP 793 – PyModExport #140550

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@encukou
pythongh-140550: allow slots that repeat information from PyModuleDef
48ab83f
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.
@encukou
encukou requested a review from ericsnowcurrently as a code owner January 30, 2026 12:43
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 30, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jan 30, 2026
Implement PEP 793 – PyModExport #140550
Open
19 of 25 tasks
@encukou
encukou marked this pull request as draft January 30, 2026 12:55
@bedevere-app bedevere-app Bot removed the awaiting core review label Jan 30, 2026
@ngoldbaum

ngoldbaum commented Jan 30, 2026 •
edited
Loading

Uh oh!

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

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.

davidhewitt and levis-makori reacted with heart emoji
All reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

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

@ngoldbaum ngoldbaum mentioned this pull request Jan 30, 2026
Use PyModExport and PyABIInfo APIs in pymodule implementation PyO3/pyo3#5753
Merged
@encukou
encukou marked this pull request as ready for review January 30, 2026 15:23
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 30, 2026
encukou
encukou commented Jan 30, 2026
View reviewed changes
Comment thread Doc/c-api/module.rst Resolved

Uh oh!

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

encukou
encukou commented Jan 30, 2026
View reviewed changes
Comment thread Objects/moduleobject.c Resolved

Uh oh!

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

@encukou
Apply suggestions from GH UI
247f1b4
vstinner
vstinner reviewed Feb 3, 2026
View reviewed changes
Comment thread Doc/c-api/module.rst Resolved

Uh oh!

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

encukou added 2 commits February 3, 2026 11:53
@encukou
Merge in the main branch
52e6de9
@encukou
Ensure the same pointer for strings
db5a64e
@ngoldbaum

ngoldbaum commented Feb 6, 2026

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 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.

@encukou
encukou merged commit b22ff1e into python:main Feb 9, 2026
47 checks passed

Uh oh!

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

@encukou
encukou deleted the slotparrot branch February 9, 2026 10:35
@bedevere-app bedevere-app Bot removed the awaiting core review label Feb 9, 2026
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
@encukou @thunder-coding
pythongh-140550: allow slots that repeat information from PyModuleDef (…
3931535
…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
@encukou @ljfp
pythongh-140550: allow slots that repeat information from PyModuleDef (…
4c9469d
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently 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

@encukou @ngoldbaum @vstinner
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.