Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
When creatingint
instances, wealways allocate space for and initialise at least one digit, since themedium_value
function that's used for fast pathsassumes the existence of that digit. This change was introduced for Python 3.11 in PR#27832.
However, the corresponding change inlong_subtype_new
was missed; this results in us asking for zero digits in the case of creating an instance of a subclass ofint
with value zero - e.g.,
classMyInt(int):passmyint=MyInt()# problem
That's then a problem ifmyint
is used in a context wheremedium_value
might be called on it, for example as inint(myint)
.
We've got away with this so far because of a compensatingoverallocation issue: see#81381; this bug blocked an attempt to address#81381 in#100855. But I believe this should still be fixed.
I'll make a PR shortly.