Skip to content

3.13.0a5 SIGSEGV when calling weakref.proxy on a class instance #117281

Closed
@befeleme

Description

@befeleme

What happened?

When building dill for Fedora Linux 41 with Python 3.13.0a5, a segmentation fault happens. The investigation leads back to Python.
The minimal reproducer for this to happen with Python 3.13.0a5 (this was working in one of the first alphas and stopped ~around alpha3):

import weakref
class A:
    pass
repr(weakref.proxy(A()))

A bt from gdb:

(gdb) bt
#0  0x00007ffff78a0a02 in Py_TYPE (ob=0x0) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Include/object.h:333
#1  0x00007ffff78a20f8 in proxy_repr (proxy=0x7fffe9cd8bb0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Objects/weakrefobject.c:476
#2  0x00007ffff77eb936 in PyObject_Repr (v=0x7fffe9cd8bb0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Objects/object.c:671
#3  0x00007ffff790bdf4 in builtin_repr (module=0x7fffe9da7a70, obj=0x7fffe9cd8bb0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/bltinmodule.c:2377
#4  0x00007ffff77e5c00 in cfunction_vectorcall_O (func=0x7fffe9dbc9b0, args=0x7ffff7fb8078, 
    nargsf=9223372036854775809, kwnames=0x0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Objects/methodobject.c:512
#5  0x00007ffff776d021 in _PyObject_VectorcallTstate (tstate=0x7ffff7d54970 <_PyRuntime+247824>, 
    callable=0x7fffe9dbc9b0, args=0x7ffff7fb8078, nargsf=9223372036854775809, kwnames=0x0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Include/internal/pycore_call.h:168
#6  0x00007ffff776de9e in PyObject_Vectorcall (callable=0x7fffe9dbc9b0, args=0x7ffff7fb8078, 
    nargsf=9223372036854775809, kwnames=0x0) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Objects/call.c:327
#7  0x00007ffff7915d85 in _PyEval_EvalFrameDefault (tstate=0x7ffff7d54970 <_PyRuntime+247824>, frame=0x7ffff7fb8020, 
    throwflag=0) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/generated_cases.c.h:817
#8  0x00007ffff790fad6 in _PyEval_EvalFrame (tstate=0x7ffff7d54970 <_PyRuntime+247824>, frame=0x7ffff7fb8020, 
    throwflag=0) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Include/internal/pycore_ceval.h:114
#9  0x00007ffff7941c7f in _PyEval_Vector (tstate=0x7ffff7d54970 <_PyRuntime+247824>, func=0x7fffe9c66210, 
    locals=0x7fffe9c7ce30, args=0x0, argcount=0, kwnames=0x0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/ceval.c:1820
#10 0x00007ffff79115e0 in PyEval_EvalCode (co=0x7fffe9da1f80, globals=0x7fffe9c7ce30, locals=0x7fffe9c7ce30)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/ceval.c:599
#11 0x00007ffff79eda45 in run_eval_code_obj (tstate=0x7ffff7d54970 <_PyRuntime+247824>, co=0x7fffe9da1f80, 
    globals=0x7fffe9c7ce30, locals=0x7fffe9c7ce30)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/pythonrun.c:1291
#12 0x00007ffff79ede15 in run_mod (mod=0x5555555ef230, filename=0x7fffe9cc4c80, globals=0x7fffe9c7ce30, 
    locals=0x7fffe9c7ce30, flags=0x7fffffffda78, arena=0x7fffe9cccfa0, interactive_src=0x0, generate_new_source=0)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/pythonrun.c:1376
#13 0x00007ffff79ed822 in pyrun_file (fp=0x555555584db0, filename=0x7fffe9cc4c80, start=257, globals=0x7fffe9c7ce30, 
    locals=0x7fffe9c7ce30, closeit=1, flags=0x7fffffffda78)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/pythonrun.c:1212
#14 0x00007ffff79ebbd3 in _PyRun_SimpleFileObject (fp=0x555555584db0, filename=0x7fffe9cc4c80, closeit=1, 
    flags=0x7fffffffda78) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/pythonrun.c:461
#15 0x00007ffff79eaf35 in _PyRun_AnyFileObject (fp=0x555555584db0, filename=0x7fffe9cc4c80, closeit=1, 
    flags=0x7fffffffda78) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Python/pythonrun.c:77
#16 0x00007ffff7a2478a in pymain_run_file_obj (program_name=0x7fffe9c7d000, filename=0x7fffe9cc4c80, 
    skip_source_first_line=0) at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:357
#17 0x00007ffff7a24864 in pymain_run_file (config=0x7ffff7d2f898 <_PyRuntime+96056>)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:376
#18 0x00007ffff7a250d6 in pymain_run_python (exitcode=0x7fffffffdc14)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:628
#19 0x00007ffff7a2521b in Py_RunMain () at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:707
#20 0x00007ffff7a252f1 in pymain_main (args=0x7fffffffdc90)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:737
#21 0x00007ffff7a253b9 in Py_BytesMain (argc=2, argv=0x7fffffffde08)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Modules/main.c:761
#22 0x000055555555517d in main (argc=2, argv=0x7fffffffde08)
    at /usr/src/debug/python3.13-3.13.0~a5-2.fc39.x86_64/Programs/python.c:15

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

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

Python 3.13.0a5 (main, Mar 13 2024, 00:00:00) [GCC 13.2.1 20240316 (Red Hat 13.2.1-7)]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-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