Mixing py::bind and PyModule_AddObject #5354
jojobugfree
started this conversation in
General
Replies: 1 comment
-
I got a "Segmentation fault" Thread 1 "python" received signal SIGSEGV, Segmentation fault.
_PyObject_IS_GC (obj=0xfffeaa5c5ff8) at /usr/local/src/conda/python-3.9.19/Include/internal/pycore_object.h:112
112 /usr/local/src/conda/python-3.9.19/Include/internal/pycore_object.h: No such file or directory.
(gdb) bt
#0 _PyObject_IS_GC (obj=0xfffeaa5c5ff8) at /usr/local/src/conda/python-3.9.19/Include/internal/pycore_object.h:112
#1 visit_decref (parent=<optimized out>, op=0xfffeaa5c5ff8) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:443
#2 dict_traverse (op=0xfffe5e740b00, visit=<optimized out>, arg=<optimized out>) at /usr/local/src/conda/python-3.9.19/Objects/dictobject.c:3148
#3 0x000000000047ad80 in subtract_refs (containers=<optimized out>) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:469
#4 deduce_unreachable (base=base@entry=0x7674a0, unreachable=unreachable@entry=0xffffffffa3f0) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:1092
#5 0x0000000000479978 in collect (tstate=tstate@entry=0x769040, generation=generation@entry=0, n_collected=n_collected@entry=0xffffffffa4b0,
n_uncollectable=n_uncollectable@entry=0xffffffffa4a8, nofail=nofail@entry=0) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:1207
#6 0x000000000054f1bc in collect_with_callback (tstate=tstate@entry=0x769040, generation=0) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:1387
#7 0x000000000046ef88 in collect_generations (tstate=0x769040) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:2269
#8 _PyObject_GC_Alloc (basicsize=<optimized out>, use_calloc=0) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:2284
#9 _PyObject_GC_Malloc (basicsize=<optimized out>) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:2294
#10 _PyObject_GC_New (tp=tp@entry=0x70d830 <PyDict_Type>) at /usr/local/src/conda/python-3.9.19/Modules/gcmodule.c:2306
#11 0x0000000000470ef8 in new_dict (values=0x7429f0 <empty_values>, keys=0x714e40 <empty_keys_struct>) at /usr/local/src/conda/python-3.9.19/Objects/dictobject.c:628
#12 PyDict_New () at /usr/local/src/conda/python-3.9.19/Objects/dictobject.c:723
#13 0x0000000000581500 in ste_new (col_offset=4, lineno=1514, key=0xfffe5e64e7b0, block=FunctionBlock, name=0xffffeaf2e7f0, st=0xfffe5e64e7b0)
at /usr/local/src/conda/python-3.9.19/Python/symtable.c:96
#14 symtable_enter_block (st=st@entry=0xfffe5e64e7b0, name=0xffffeaf2e7f0, block=block@entry=FunctionBlock, ast=ast@entry=0xf357668, lineno=1514, col_offset=4)
at /usr/local/src/conda/python-3.9.19/Python/symtable.c:973
#15 0x00000000004fb274 in symtable_visit_stmt (st=st@entry=0xfffe5e64e7b0, s=0xf357668) at /usr/local/src/conda/python-3.9.19/Python/symtable.c:1191
#16 0x00000000004fb904 in symtable_visit_stmt (st=st@entry=0xfffe5e64e7b0, s=<optimized out>) at /usr/local/src/conda/python-3.9.19/Python/symtable.c:1213
#17 0x0000000000580830 in PySymtable_BuildObject (mod=mod@entry=0xf3d7050, filename=filename@entry=0xfffeaa739180, future=<optimized out>)
at /usr/local/src/conda/python-3.9.19/Python/symtable.c:305
#18 0x000000000057f6f0 in PyAST_CompileObject (mod=0xf3d7050, filename=filename@entry=0xfffeaa739180, flags=flags@entry=0xffffffffa830, optimize=optimize@entry=-1,
arena=arena@entry=0xfffe5e78ae30) at /usr/local/src/conda/python-3.9.19/Python/compile.c:363
#19 0x000000000056a960 in Py_CompileStringObject (
str=0xf13a2b0 "# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).\n#\n# Copyright 2020-2024 Huawei Technologies Co., Ltd\n#\n# Licensed under the Apache License, Version 2."..., filename=filename@entry=0xfffeaa739180, start=257, flags=flags@entry=0xffffffffa830,
optimize=optimize@entry=-1) at /usr/local/src/conda/python-3.9.19/Python/pythonrun.c:1316
#20 0x0000000000565cf0 in builtin_compile_impl (module=<optimized out>, feature_version=<optimized out>, optimize=-1, dont_inherit=1, flags=0, mode=<optimized out>,
filename=0xfffeaa739180, source=0xf13a290) at /usr/local/src/conda/python-3.9.19/Python/Python-ast.c:10851
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created a module using py::module. Based on this, can I get the PyObject* of this module and then call PyModule_AddObject to create a new type?
The code looks like:
Beta Was this translation helpful? Give feedback.
All reactions