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
decimal.getcontext crashes with --with-decimal-contextvar=no and -X showrefcount #123657
This is a problem in itself, since this is a leak, but after configuring with --with-decimal-contextvar=no, then the above code fails with a negative reference count:
Python/gc.c:92: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small
Enable tracemalloc to get the memory block allocation traceback
object address : 0x5d3d7d336490
object refcount : 1
object type : 0x5d3d7d4acd50
object type name: decimal.Context
object repr : Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])
It seems both of these problems were caused by #123244
(@encukou, this needs extension-modules, 3.14 and 3.13)
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
changed the title [-]`decimal.getcontext` is problematic [/-][+]`decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount`[/+]on Sep 5, 2024
Activity
Eclips4 commentedon Sep 4, 2024
cc @neonene
[-]`decimal.getcontext` is problematic [/-][+]`decimal.getcontext` crashes with `--with-decimal-contextvar=no` and `-X showrefcount`[/+]gh-123657: Fix crash and refleak in `decimal.getcontext()` (GH-123703)
pythongh-123657: Fix crash and refleak in `decimal.getcontext()` (pyt…
[3.13] gh-123657: Fix crash and refleak in `decimal.getcontext()` (GH…
encukou commentedon Sep 6, 2024
Thanks @ZeroIntensity/@godlygeek for the report, and @neonene for the fix!