Skip to content

__file__ for Some Dynamic Extension Modules has a Broken Refcount #118733

Open
@ericsnowcurrently

Description

@ericsnowcurrently

Bug report

Bug description:

In gh-118532 I was getting crashes when the _testsinglephase module's cached copy of __dict__ was finalized. I worked around it in that PR by doing an unconditional incref, but that introduced a refleak for other cases. At the time, I wasn't able to determine if gh-118532 was the source of the refcount problem or if it only exposed an existing problem.

While working on gh-118157 I narrowed the problem down to the __file__ value in the cached __dict__ and resolved it by interning the string. However, the underlying problem remains: somewhere along the line there seems to be a missing incref.

That needs to be located and fixed, and then the interning can be dropped.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions