Skip to content

gh-111178: Fix PyCMethod API #131135

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged

gh-111178: Fix PyCMethod API #131135

merged 1 commit into from
Mar 12, 2025

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 12, 2025

Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.

Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.
@vstinner
Copy link
Member Author

PyCMethod is documented and the documentation already uses Py_ssize_t: https://docs.python.org/dev/c-api/structures.html#c.PyCMethod

Screenshot 2025-03-12 at 08-31-47 Common Object Structures — Python 3 14 0a5 documentation

@vstinner
Copy link
Member Author

@encukou: Is it ok to change the sign of the nargs parameter in PyCMethod? In practice, Python already calls PyCMethod with signed Py_ssize_t and functions are already implemented with signed Py_ssize_t. Also, as I wrote, the documentation also already uses signed Py_ssize_t.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

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

I believe it is. Thanks!

@encukou encukou merged commit 4dcbe06 into python:main Mar 12, 2025
48 checks passed
@vstinner vstinner deleted the pycmethod branch March 12, 2025 11:18
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…31135)

Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.
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.

2 participants