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) {
446
446
/*
447
447
This is a workaround for C++ modules, namely PyTorch, that declare global/static variables with destructors that call
448
448
_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 .
450
450
*/
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
+ }
452
457
void 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 ;
455
460
}
456
461
457
462
PyObject * PyTuple_Pack (Py_ssize_t n , ...) {
You can’t perform that action at this time.
0 commit comments