You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Outdated PyObject_HasAttr documentation (it no longer behaves like builtin hasattr) #113391
I think the sentence "This is equivalent to the Python expression hasattr(o, attr_name)." - must be removed. It actually belongs to the PyObject_HasAttrWithError().
@skirpichev I saw that a pull request to fix this was merged, but the issue is still open, is it OK to close it now ? Thanks again for the fix and sorry for this question, I'm not familiar with how python uses issue tracker
changed the title [-]Outdated PyObject_HasAttr documentation ( it no longer behaves like builtin `hasattr` )[/-][+]Outdated PyObject_HasAttr documentation (it no longer behaves like builtin `hasattr`)[/+]on Jan 11, 2024
Just got back to this.
On 3.12 and below, PyObject_HasAttris the closest thing to hasattr(o, attr_name). The difference from the Python function is in error handling, and the sentence just after the removed note makes things very clear.
So, I'll not backport.
Effectively, in 3.13 the “equivalent to hasattr” note was moved from PyObject_HasAttr to PyObject_HasAttrWithError.
Activity
serhiy-storchaka commentedon Dec 22, 2023
Isn't the following note enough?
cpython/Doc/c-api/object.rst
Lines 54 to 59 in c31943a
pythongh-113391: fix outdated PyObject_HasAttr sphinx docs
skirpichev commentedon Dec 23, 2023
I think the sentence "This is equivalent to the Python expression
hasattr(o, attr_name)." - must be removed. It actually belongs to thePyObject_HasAttrWithError().perrinjerome commentedon Dec 23, 2023
Removing that sentence seems good, I was confused by that part because it contradicts the note below. Thank you !
gh-113391: fix outdated PyObject_HasAttr docs (#113420)
perrinjerome commentedon Jan 11, 2024
@skirpichev I saw that a pull request to fix this was merged, but the issue is still open, is it OK to close it now ? Thanks again for the fix and sorry for this question, I'm not familiar with how python uses issue tracker
skirpichev commentedon Jan 11, 2024
Yeah, I think so.
But maybe it's stay opened intentionally. @encukou ?
encukou commentedon Jan 11, 2024
I want to look at the docs for 3.12 (and 3.11) too, but didn't get to it yet.
skirpichev commentedon Jan 11, 2024
[-]Outdated PyObject_HasAttr documentation ( it no longer behaves like builtin `hasattr` )[/-][+]Outdated PyObject_HasAttr documentation (it no longer behaves like builtin `hasattr`)[/+]encukou commentedon Jan 16, 2024
Just got back to this.
On 3.12 and below,
PyObject_HasAttris the closest thing tohasattr(o, attr_name). The difference from the Python function is in error handling, and the sentence just after the removed note makes things very clear.So, I'll not backport.
Effectively, in 3.13 the “equivalent to
hasattr” note was moved fromPyObject_HasAttrtoPyObject_HasAttrWithError.Feel free to reopen/comment if you disagree.
pythongh-113391: fix outdated PyObject_HasAttr docs (python#113420)
pythongh-113391: fix outdated PyObject_HasAttr docs (python#113420)
pythongh-113391: fix outdated PyObject_HasAttr docs (python#113420)