Closed
Description
Reproducer:
def func():
print(
42
)
import pdb; pdb.set_trace()
func()
Crash:
@kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python main.py
> /workspaces/cpython/main.py(7)<module>()
-> func()
(Pdb) s
--Call--
> /workspaces/cpython/main.py(1)func()
-> def func():
(Pdb) n
> /workspaces/cpython/main.py(2)func()
-> print(
(Pdb) n
> /workspaces/cpython/main.py(3)func()
-> 42
(Pdb) j 1
> /workspaces/cpython/main.py(1)func()
-> def func():
(Pdb) exit
Traceback (most recent call last):
File "/workspaces/cpython/main.py", line 7, in <module>
func()
^^^^^^
File "/workspaces/cpython/main.py", line 1, in func
def func():
File "/workspaces/cpython/main.py", line 1, in func
def func():
File "/workspaces/cpython/Lib/bdb.py", line 90, in trace_dispatch
return self.dispatch_line(frame)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/cpython/Lib/bdb.py", line 115, in dispatch_line
if self.quitting: raise BdbQuit
^^^^^^^^^^^^^
bdb.BdbQuit
Modules/gcmodule.c:113: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small
Enable tracemalloc to get the memory block allocation traceback
object address : 0x7f18ff3b81d0
object refcount : 2
object type : 0x55cfef2a6460
object type name: builtin_function_or_method
object repr : <built-in function print>
Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: finalizing (tstate=0x000055cfef3bca48)
Current thread 0x00007f18ff707280 (most recent call first):
Garbage-collecting
<no Python frame>
Aborted (core dumped)
GDB stack trace (main)
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7c71859 in __GI_abort () at abort.c:79
#2 0x000055555585db52 in fatal_error_exit (status=-1) at Python/pylifecycle.c:2614
#3 fatal_error (fd=2, header=header@entry=1, prefix=<optimized out>,
prefix@entry=0x55555594cd70 <__func__.19026> "_PyObject_AssertFailed", msg=<optimized out>,
msg@entry=0x55555594c575 "_PyObject_AssertFailed", status=status@entry=-1)
at Python/pylifecycle.c:2795
#4 0x000055555585dbb4 in _Py_FatalErrorFunc (
func=func@entry=0x55555594cd70 <__func__.19026> "_PyObject_AssertFailed",
msg=msg@entry=0x55555594c575 "_PyObject_AssertFailed") at Python/pylifecycle.c:2811
#5 0x00005555557431d2 in _PyObject_AssertFailed (
obj=obj@entry=<built-in method print of module object at remote 0x7ffff78f32f0>,
expr=expr@entry=0x5555559ab18c "gc_get_refs(g) > 0",
msg=msg@entry=0x55555594c5eb "refcount is too small",
file=file@entry=0x5555559ab11c "Modules/gcmodule.c", line=line@entry=113,
function=function@entry=0x5555559ab6c8 <__func__.18373> "gc_decref") at Objects/object.c:2360
#6 0x000055555588ad50 in gc_decref (g=0x7ffff79001c0) at Modules/gcmodule.c:116
#7 visit_decref (op=<built-in method print of module object at remote 0x7ffff78f32f0>,
parent=0x7ffff7900ad0) at Modules/gcmodule.c:459
#8 0x00005555557249a5 in dict_traverse (op=<optimized out>, visit=0x55555588ac96 <visit_decref>,
arg=0x7ffff7900ad0) at Objects/dictobject.c:3547
#9 0x000055555588a741 in subtract_refs (
containers=containers@entry=0x555555b869a8 <_PyRuntime+53896>) at Modules/gcmodule.c:478
#10 0x000055555588be95 in deduce_unreachable (unreachable=0x7fffffffc1d0,
base=0x555555b869a8 <_PyRuntime+53896>) at Modules/gcmodule.c:1100
#11 gc_collect_main (tstate=tstate@entry=0x555555ba0a48 <_PyRuntime+160552>,
generation=generation@entry=2, n_collected=n_collected@entry=0x7fffffffc258,
n_uncollectable=n_uncollectable@entry=0x7fffffffc260, nofail=nofail@entry=0)
at Modules/gcmodule.c:1226
Python versions tested:
Metadata
Assignees
Labels
Projects
Status
Done
Activity