Skip to content

gh-135075: Make PyObject_SetAttr() fail with NULL value and exception#136180

Merged
vstinner merged 12 commits into
python:mainfrom
vstinner:setattr_null_error
Jul 3, 2025
Merged

gh-135075: Make PyObject_SetAttr() fail with NULL value and exception#136180
vstinner merged 12 commits into
python:mainfrom
vstinner:setattr_null_error

Conversation

@vstinner

@vstinner vstinner commented Jul 1, 2025

Copy link
Copy Markdown
Member

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called with NULL value and an exception set.


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

…eption

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.

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

Generally looks good to me.

Comment thread Doc/c-api/object.rst
Comment thread Objects/object.c
Comment thread Objects/object.c

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

Thanks, LGTM.

@serhiy-storchaka serhiy-storchaka 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 that Modules/_testcapi/abstract.c is better place than Modules/_testcapi/object.c.

Comment thread Doc/c-api/object.rst
Comment thread Lib/test/test_capi/test_object.py Outdated
Comment thread Modules/_testcapi/object.c Outdated
Comment thread Modules/_testcapi/object.c Outdated
@vstinner

vstinner commented Jul 2, 2025

Copy link
Copy Markdown
Member Author

I think that Modules/_testcapi/abstract.c is better place than Modules/_testcapi/object.c.

I moved the C code.

Comment thread Lib/test/test_capi/test_object.py Outdated
Comment thread Doc/c-api/object.rst
Comment thread Doc/c-api/object.rst Outdated
Comment thread Lib/test/test_capi/test_object.py Outdated

@serhiy-storchaka serhiy-storchaka 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.

LGTM, although I think that the documentation could be improved.

Comment thread Lib/test/test_capi/test_object.py Outdated
@vstinner vstinner merged commit da79ac9 into python:main Jul 3, 2025
40 checks passed
@vstinner vstinner deleted the setattr_null_error branch July 3, 2025 12:51
@vstinner

vstinner commented Jul 3, 2025

Copy link
Copy Markdown
Member Author

Merged, thanks for reviews.

LGTM, although I think that the documentation could be improved.

I'm not good at writing documentation. Since the PR got multiple approvals, I merged my PR.

AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
…eption (python#136180)

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…eption (python#136180)

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
picnixz pushed a commit to picnixz/cpython that referenced this pull request Jul 13, 2025
…eption (python#136180)

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…eption (python#136180)

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
…eption (python#136180)

Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
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.

5 participants