Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

decimal.getcontext crashes with--with-decimal-contextvar=no and-X showrefcount #123657

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump
@ZeroIntensity

Description

@ZeroIntensity

Crash report

What happened?

cc@godlygeek, who helped me find this

I was investigating a reference leak on the asyncio test suite, and I came acrossdecimal.getcontext leaking some memory. Here's what I was doing:

$ ./python -Xshowrefcount -c "import decimal; decimal.getcontext()"[207 refs, 0 blocks]

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 smallEnable tracemalloc to get the memory block allocation tracebackobject address  : 0x5d3d7d336490object refcount : 1object type     : 0x5d3d7d4acd50object type name: decimal.Contextobject 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 needsextension-modules,3.14 and3.13)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp