gh-94673: More Per-Interpreter Fields for Builtin Static Types by ericsnowcurrently · Pull Request #103912 · python/cpython (original) (raw)

git bisect got me here.

I'm testing Python 3.12 with pybind11 (master @ https://github.com/pybind/pybind11/tree/d72ffb448c58b4ffb08b5ad629bc788646e2d59e).

# first bad commit: [de64e7561680fdc5358001e9488091e75d4174a3] gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)

I double-checked that this is true:

The gdb backtrace is below. #0 & #1 are pointing here:

Does this ring any bells? Is there something obvious that we need to do differently in pybind11?

Steps to reproduce are involved, roughly:

I can send more details or try to reduce as needed. Please let me know.

#0  0x00007ffff592a646 in Py_TYPE (ob=0x0) at /usr/local/google/home/rwgk/usr_local_like/cpython_git_bisect/include/python3.12/object.h:204
#1  0x00007ffff5930245 in pybind11::detail::iterator_policies::sequence_fast_readonly::sequence_fast_readonly (this=0x7fffffffa8d8, 
    obj=..., n=0) at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/../pytypes.h:1168
#2  0x00007ffff5940c9b in pybind11::detail::generic_iterator<pybind11::detail::iterator_policies::sequence_fast_readonly>::generic_iterator
    (this=0x7fffffffa8d8, seq=..., index=0)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/../pytypes.h:1095
#3  0x00007ffff5931401 in pybind11::tuple::begin (this=0x7fffffffa970)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/../pytypes.h:1983
#4  0x00007ffff59339ba in pybind11::detail::all_type_info_populate (t=0x555555aa1f00 <PyBaseObject_Type>, 
    bases=std::vector of length 0, capacity 0)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/type_caster_base.h:108
#5  0x00007ffff5933e2c in pybind11::detail::all_type_info (type=0x555555aa1f00 <PyBaseObject_Type>)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/type_caster_base.h:173
#6  0x00007ffff5933e56 in pybind11::detail::get_type_info (type=0x555555aa1f00 <PyBaseObject_Type>)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/detail/../detail/type_caster_base.h:185
#7  0x00007ffff593eda5 in pybind11::detail::generic_type::mark_parents_nonsimple (this=0x7fffffffb038, value=0x555556021f90)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1368
#8  0x00007ffff593ede2 in pybind11::detail::generic_type::mark_parents_nonsimple (this=0x7fffffffb038, value=0x5555560cd900)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1372
#9  0x00007ffff593ede2 in pybind11::detail::generic_type::mark_parents_nonsimple (this=0x7fffffffb038, value=0x5555560ceb20)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1372
#10 0x00007ffff593ea53 in pybind11::detail::generic_type::initialize (this=0x7fffffffb038, rec=...)
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1346
#11 0x00007ffff5cebccc in pybind11::class_<test_submodule_multiple_inheritance(pybind11::module_&)::Base12, test_submodule_multiple_inheritance(pybind11::module_&)::Base1, test_submodule_multiple_inheritance(pybind11::module_&)::Base2>::class_<>(pybind11::handle, const char *) (
    this=0x7fffffffb038, scope=..., name=0x7ffff6167b1f "Base12")
    at /usr/local/google/home/rwgk/forked/pybind11/include/pybind11/pybind11.h:1553
#12 0x00007ffff5ce98f9 in test_submodule_multiple_inheritance (m=...)
    at /usr/local/google/home/rwgk/forked/pybind11/tests/test_multiple_inheritance.cpp:113
#13 0x00007ffff592aaf6 in operator() (__closure=0x555555fb0da0, parent=...)
    at /usr/local/google/home/rwgk/forked/pybind11/tests/pybind11_tests.cpp:40
#14 0x00007ffff592ce8b in std::__invoke_impl<void, test_initializer::test_initializer(char const*, Initializer)::<lambda(pybind11::module_&)>&, pybind11::module_&>(std::__invoke_other, struct {...} &) (__f=...) at /usr/include/c++/12/bits/invoke.h:61
#15 0x00007ffff592cd56 in std::__invoke_r<void, test_initializer::test_initializer(char const*, Initializer)::<lambda(pybind11::module_&)>&, pybind11::module_&>(struct {...} &) (__fn=...) at /usr/include/c++/12/bits/invoke.h:111
#16 0x00007ffff592cc25 in std::_Function_handler<void(pybind11::module_&), test_initializer::test_initializer(char const*, Initializer)::<lambda(pybind11::module_&)> >::_M_invoke(const std::_Any_data &, pybind11::module_ &) (__functor=..., __args#0=...)
    at /usr/include/c++/12/bits/std_function.h:290
#17 0x00007ffff59468a5 in std::function<void (pybind11::module_&)>::operator()(pybind11::module_&) const (this=0x555555fb0da0, 
    __args#0=...) at /usr/include/c++/12/bits/std_function.h:591
#18 0x00007ffff592b433 in pybind11_init_pybind11_tests (m=...) at /usr/local/google/home/rwgk/forked/pybind11/tests/pybind11_tests.cpp:121
#19 0x00007ffff592adfb in PyInit_pybind11_tests () at /usr/local/google/home/rwgk/forked/pybind11/tests/pybind11_tests.cpp:78
#20 0x0000555555802cba in _PyImport_LoadDynamicModuleWithSpec (spec=spec@entry=0x7ffff66e22a0, fp=fp@entry=0x0) at ./Python/importdl.c:169
#21 0x00005555557fdcb2 in _imp_create_dynamic_impl (module=<optimized out>, file=0x0, spec=0x7ffff66e22a0) at Python/import.c:3721
#22 _imp_create_dynamic (module=<optimized out>, args=<optimized out>, nargs=<optimized out>) at Python/clinic/import.c.h:506
#23 0x00005555557104e3 in cfunction_vectorcall_FASTCALL (func=0x7ffff7c72b10, args=0x7ffff66e1768, nargsf=<optimized out>, 
    kwnames=<optimized out>) at ./Include/cpython/methodobject.h:50
#24 0x0000555555650290 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9678, throwflag=<optimized out>)
    at Python/bytecodes.c:3125
#25 0x00005555556b5cc7 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=2, args=0x7fffffffba70, callable=0x7ffff7c47f60, 
    tstate=0x555555bf2208 <_PyRuntime+460904>) at ./Include/internal/pycore_call.h:92
#26 object_vacall (tstate=tstate@entry=0x555555bf2208 <_PyRuntime+460904>, base=base@entry=0x0, callable=0x7ffff7c47f60, 
    vargs=vargs@entry=0x7fffffffbaf8) at Objects/call.c:818
#27 0x00005555556b73c0 in PyObject_CallMethodObjArgs (obj=0x0, name=<optimized out>) at Objects/call.c:879
#28 0x0000555555800dce in import_find_and_load (abs_name=0x7ffff66fdbb0, tstate=0x555555bf2208 <_PyRuntime+460904>) at Python/import.c:2715
#29 PyImport_ImportModuleLevelObject (name=name@entry=0x7ffff66fdbb0, globals=<optimized out>, locals=<optimized out>, 
    fromlist=fromlist@entry=0x555555a9e460 <_Py_NoneStruct>, level=0) at Python/import.c:2798
#30 0x000055555565a49b in import_name (level=0x555555b82620 <_PyRuntime+3200>, fromlist=0x555555a9e460 <_Py_NoneStruct>, 
    name=0x7ffff66fdbb0, frame=0x7ffff7fb9318, tstate=<optimized out>) at Python/ceval.c:2350
#31 _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9318, throwflag=<optimized out>) at Python/bytecodes.c:2000
#32 0x00005555557cb467 in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7fb9318, tstate=0x555555bf2208 <_PyRuntime+460904>)
    at ./Include/internal/pycore_ceval.h:88
#33 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7ffff66fc340, func=0x7ffff66e9620, 
    tstate=0x555555bf2208 <_PyRuntime+460904>) at Python/ceval.c:1575
#34 PyEval_EvalCode (co=co@entry=0x555555fee3c0, globals=globals@entry=0x7ffff66fc340, locals=locals@entry=0x7ffff66fc340)
    at Python/ceval.c:566
#35 0x00005555557c7640 in builtin_exec_impl (module=<optimized out>, closure=<optimized out>, locals=0x7ffff66fc340, 
    globals=0x7ffff66fc340, source=0x555555fee3c0) at Python/bltinmodule.c:1079
#36 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>)
    at Python/clinic/bltinmodule.c.h:586
#37 0x000055555571025f in cfunction_vectorcall_FASTCALL_KEYWORDS (func=0x7ffff7c716c0, args=0x7ffff7fb92f8, nargsf=<optimized out>, 
    kwnames=<optimized out>) at ./Include/cpython/methodobject.h:50
#38 0x00005555556b6150 in _PyObject_VectorcallTstate (kwnames=0x555555b93e18 <_PyRuntime+74872>, nargsf=<optimized out>, 
    args=0x555555a9e460 <_Py_NoneStruct>, callable=0x7ffff7c716c0, tstate=0x555555bf2208 <_PyRuntime+460904>)
    at ./Include/internal/pycore_call.h:92
#39 PyObject_Vectorcall (callable=callable@entry=0x7ffff7c716c0, args=args@entry=0x7ffff7fb92f8, nargsf=<optimized out>, 
    kwnames=kwnames@entry=0x0) at Objects/call.c:291
#40 0x000055555565477b in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9248, throwflag=<optimized out>)
    at Python/bytecodes.c:2577
#41 0x00005555556b9c41 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=2, args=0x7fffffffc0e0, callable=0x7ffff6bd6e80, 
    tstate=0x555555bf2208 <_PyRuntime+460904>) at ./Include/internal/pycore_call.h:92
#42 method_vectorcall (method=<optimized out>, args=0x7ffff66c2608, nargsf=<optimized out>, kwnames=0x0) at Objects/classobject.c:89
#43 0x0000555555650290 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb89c0, throwflag=<optimized out>)
    at Python/bytecodes.c:3125
#44 0x00005555556b815f in _PyObject_FastCallDictTstate (kwargs=0x7ffff66bdc00, nargsf=<optimized out>, args=0x7fffffffc300, 
    callable=0x7ffff7597240, tstate=0x555555bf2208 <_PyRuntime+460904>) at Objects/call.c:144
#45 _PyObject_Call_Prepend (tstate=tstate@entry=0x555555bf2208 <_PyRuntime+460904>, callable=callable@entry=0x7ffff7597240, 
    obj=obj@entry=0x7ffff6806a80, args=args@entry=0x555555b93db0 <_PyRuntime+74768>, kwargs=kwargs@entry=0x7ffff66f3ac0)
    at Objects/call.c:476
#46 0x0000555555737d4d in slot_tp_call (self=0x7ffff6806a80, args=0x555555b93db0 <_PyRuntime+74768>, kwds=0x7ffff66f3ac0)
    at Objects/typeobject.c:8474
#47 0x00005555556b5874 in _PyObject_MakeTpCall (tstate=0x555555bf2208 <_PyRuntime+460904>, callable=0x7ffff6806a80, args=0x7ffff7fb8850, 
    nargs=<optimized out>, keywords=0x7ffff6b6a800) at Objects/call.c:206
#48 0x00005555556b61af in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>, 
    callable=<optimized out>, tstate=<optimized out>) at ./Include/internal/pycore_call.h:90
#49 _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>, 
    tstate=<optimized out>) at ./Include/internal/pycore_call.h:77
#50 PyObject_Vectorcall (callable=<optimized out>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>)
    at Objects/call.c:291
#51 0x0000555555e9b056 in ?? ()
#52 0x00007ffff66b3980 in ?? ()
#53 0x00007fff00000003 in ?? ()
#54 0x0000555555a122e0 in ?? ()
#55 0x00007ffff7fb8850 in ?? ()
#56 0x0000000000000000 in ?? ()