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
When creating int instances, we always allocate space for and initialise at least one digit, since the medium_value function that's used for fast paths assumes the existence of that digit. This change was introduced for Python 3.11 in PR #27832.
However, the corresponding change in long_subtype_new was missed; this results in us asking for zero digits in the case of creating an instance of a subclass of int with value zero - e.g.,
classMyInt(int):
passmyint=MyInt() # problem
That's then a problem if myint is used in a context where medium_value might be called on it, for example as in int(myint).
We've got away with this so far because of a compensating overallocation issue: see #81381; this bug blocked an attempt to address #81381 in #100855. But I believe this should still be fixed.
Activity
pythongh-101037: Fix memory allocation for zeros of int subtypes
pythongh-101037: Fix memory allocation for zeros of int subtypes
gh-101037: Fix potential memory underallocation for zeros of int subt…
pythongh-101037: Fix potential memory underallocation for zeros of in…
[3.11] gh-101037: Fix potential memory underallocation for zeros of i…