Skip to content

_testcapi.set_nomemoy(0) will raise fatal error when --with-pydebug --with-trace-refs #138688

@yihong0618

Description

@yihong0618

Bug report

Bug description:

./configure --with-pydebug --with-trace-refs
make -j16
./python

more can check #138491 cc @ZeroIntensity

import _testcapi
_testcapi.set_nomeory(0)
Python 3.15.0a0 (heads/main:5edfe55acf2, Sep 9 2025, 09:49:31) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
^[[A>>> import _testcapi
KeyboardInterrupt

import _testcapi
_testcapi.set_nomemory(0)
Fatal Python error: _PyRefchain_Trace: _Py_hashtable_set() memory allocation failed
Python runtime state: initialized

Current thread 0x0000ffffa2ca8020 [python] (most recent call first):
File "/home/hyi/cpython/Lib/_pyrepl/console.py", line 182 in runcode
File "/home/hyi/cpython/Lib/_pyrepl/console.py", line 239 in runsource
File "/home/hyi/cpython/Lib/code.py", line 324 in push
File "/home/hyi/cpython/Lib/_pyrepl/simple_interact.py", line 151 in run_multiline_interactive_console
File "/home/hyi/cpython/Lib/_pyrepl/main.py", line 58 in interactive_console

Extension modules: _testcapi (total: 1)
Aborted

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtestsTests in the Lib/test dirtopic-C-APItype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions