Skip to content

gh-111178: Change Argument Clinic signature for METH_O - #130682

Merged
vstinner merged 10 commits into
python:mainfrom
vstinner:clinic_self
Mar 11, 2025
Merged

vstinner merged 10 commits into
python:mainfrom
vstinner:clinic_self

Conversation

@vstinner

@vstinner vstinner commented Feb 28, 2025 •

Copy link
Copy Markdown
Member

Use "PyObject*" for METH_O functions to fix an undefined behavior.

@vstinner

Copy link
Copy Markdown
Member Author

@erlend-aasland: Would you mind to review this change? Focus on the first and third commit, the second one only updates generated code.

This change is a follow-up of PR #128447 (commit 537296c).

Example with list_append() signature:

  • Before: list_append(PyListObject *self, PyObject *object)
  • After: list_append(PyObject *self, PyObject *object)

which is the correct signature for methods: typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);.

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

The manual modifications look correct to me but for the AC part I don't know if there are more assumptions I'm not aware of.

Comment thread Modules/_io/bufferedio.c Resolved
@rhettinger
rhettinger removed their request for review March 10, 2025 22:41
@vstinner
vstinner merged commit 9d759b6 into python:main Mar 11, 2025
@vstinner
vstinner deleted the clinic_self branch March 11, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants