Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
encukou wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromencukou:slotparrot

Conversation

@encukou
Copy link
Member

@encukouencukou commentedJan 30, 2026
edited by github-actionsbot
Loading

From feedback on thediscussion 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 toreuse the the same slots array for the MethodDef.Allow slots that match what's already present in the PyModuleDef.
@ngoldbaum
Copy link
Contributor

ngoldbaum commentedJan 30, 2026
edited
Loading

I can confirm that with this PR the PyO3 tests all pass on myfor-petr branch, which uses the same slots array for both initialization hooks and unconditionally setsm_name andm_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.

the module name must be given as :c:member:`PyModuleDef.m_name`.
If the array contains slots corresponding to :c:type:`PyModuleDef`
members, the values must match.
For example,if you use :c:macro:`Py_mod_name` in :c:member:`!m_slots`;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Suggested change
For example, if you use:c:macro:`Py_mod_name` in:c:member:`!m_slots`;
For example, if you use:c:macro:`Py_mod_name` in:c:member:`!m_slots`,

#undef DEF_SLOT_CASE
#undef COPY_DEF_SLOT
#undef COPY_NONDEF_SLOT
#undef _COPY_COMMON_SLOT
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Suggested change
#undef_COPY_COMMON_SLOT
#undefCOPY_NONNULL_SLOT

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@encukou@ngoldbaum

[8]ページ先頭

©2009-2026 Movatter.jp