File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
graalpython/com.oracle.graal.python.jni/src Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -446,12 +446,17 @@ void Py_IncRef(PyObject *a) {
446446/*
447447This is a workaround for C++ modules, namely PyTorch, that declare global/static variables with destructors that call
448448_Py_DECREF. The destructors get called by libc during exit during which we cannot make upcalls as that would segfault.
449- So we rebind them to no-ops when exitting .
449+ So we rebind them to no-ops when exiting .
450450*/
451- static void nop_Py_DecRef (PyObject * obj ) {}
451+ Py_ssize_t nop_GraalPy_get_PyObject_ob_refcnt (PyObject * obj ) {
452+ return 100 ; // large dummy refcount
453+ }
454+ void nop_GraalPy_set_PyObject_ob_refcnt (PyObject * obj , Py_ssize_t refcnt ) {
455+ // do nothing
456+ }
452457void finalizeCAPI () {
453- __target___Py_DecRef = nop_Py_DecRef ;
454- __target__Py_DecRef = nop_Py_DecRef ;
458+ GraalPy_get_PyObject_ob_refcnt = nop_GraalPy_get_PyObject_ob_refcnt ;
459+ GraalPy_set_PyObject_ob_refcnt = nop_GraalPy_set_PyObject_ob_refcnt ;
455460}
456461
457462PyObject * PyTuple_Pack (Py_ssize_t n , ...) {
You can’t perform that action at this time.
0 commit comments