Skip to content

gh-76595: Add note on PyCapsule_Import behavior#134022

Merged
ZeroIntensity merged 3 commits into
python:mainfrom
NicolasT:document-pycapsule-import-attr-lookup
Jun 28, 2025
Merged

gh-76595: Add note on PyCapsule_Import behavior#134022
ZeroIntensity merged 3 commits into
python:mainfrom
NicolasT:document-pycapsule-import-attr-lookup

Conversation

@NicolasT

@NicolasT NicolasT commented May 14, 2025

Copy link
Copy Markdown
Contributor

I was somewhat surprised by this behavior recently, so thought it'd be useful to have a note in the docs.

There's a PR (GH-6898) which changes this behavior (to be less surprising, I believe), but this seems to have stalled.

See: #76595
See: #6898


📚 Documentation preview 📚: https://cpython-previews--134022.org.readthedocs.build/en/134022/c-api/capsule.html#c.PyCapsule_Import

There's a PR (pythonGH-6898) which changes this behavior (to be less
surprising, I believe), but this seems to have stalled.

See: python#76595
See: python#6898

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should split up the note. The behavior regarding attribute lookups should go in the canonical description of the function, and then the gotcha about imports should be in the note.

Comment thread Doc/c-api/capsule.rst Outdated
Comment thread Doc/c-api/capsule.rst Outdated
@NicolasT

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I tried to handle both of the requested changes.

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm happy with this. Someone else is free to nitpick the wording here.

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reapplying my review. I'll merge this tomorrow if there aren't any objections to the wording.

@ZeroIntensity ZeroIntensity merged commit 579acf4 into python:main Jun 28, 2025
25 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 28, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @NicolasT for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 28, 2025
)

(cherry picked from commit 579acf4)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
@bedevere-app

bedevere-app Bot commented Jun 28, 2025

Copy link
Copy Markdown

GH-136074 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 28, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 28, 2025
)

(cherry picked from commit 579acf4)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
@bedevere-app

bedevere-app Bot commented Jun 28, 2025

Copy link
Copy Markdown

GH-136075 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 28, 2025
ZeroIntensity pushed a commit that referenced this pull request Jun 28, 2025
…H-136075)

gh-76595: Add note on `PyCapsule_Import` behavior (GH-134022)
(cherry picked from commit 579acf4)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
ZeroIntensity pushed a commit that referenced this pull request Jun 28, 2025
…H-136074)

gh-76595: Add note on `PyCapsule_Import` behavior (GH-134022)
(cherry picked from commit 579acf4)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-C-API

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants