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
A failed assignment to an attribute defined with PyMemberDef changes its value in 3.13 #156196
PyMember_SetOne() stores the result of the conversion before checking for an error, so a failed assignment leaves a garbage value in the attribute.
>>> e =UnicodeDecodeError('utf-8', b'x', 0, 1, 'bad')
>>> e.start
0
>>> e.start =2**1000
Traceback (most recent call last):
...
OverflowError: Python int too large to convert to C ssize_t
>>> e.start
-1
This affects the Py_T_LONG, Py_T_LONGLONG, Py_T_PYSSIZET and Py_T_DOUBLE cases. The other integer types already convert, check and only then store.
In 3.14 and newer the value is stored after the check (changed in gh-117657, GH-123211), so only 3.13 is affected.
Activity
[3.13] gh-156196: Fix a failed assignment to a PyMemberDef attribute …