@@ -2328,17 +2328,22 @@ dummy_func(
2328
2328
PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 1 );
2329
2329
if (oparg & 1 ) {
2330
2330
/* Designed to work in tandem with CALL, pushes two values. */
2331
- _PyStackRef method = PyStackRef_NULL ;
2332
- int is_meth = _PyObject_GetMethodStackRef (tstate , PyStackRef_AsPyObjectBorrow (owner ), name , & method );
2331
+ _PyCStackRef method ;
2332
+ _PyThreadState_PushCStackRef (tstate , & method );
2333
+ int is_meth = _PyObject_GetMethodStackRef (tstate , PyStackRef_AsPyObjectBorrow (owner ), name , & method .ref );
2333
2334
if (is_meth ) {
2334
2335
/* We can bypass temporary bound method object.
2335
2336
meth is unbound method and obj is self.
2336
2337
meth | self | arg1 | ... | argN
2337
2338
*/
2338
- assert (!PyStackRef_IsNull (method )); // No errors on this branch
2339
+ assert (!PyStackRef_IsNull (method . ref )); // No errors on this branch
2339
2340
self_or_null [0 ] = owner ; // Transfer ownership
2340
2341
DEAD (owner );
2341
- attr = method ;
2342
+ attr = method .ref ;
2343
+ #ifdef Py_GIL_DISABLED
2344
+ method_ref .ref = PyStackRef_NULL ;
2345
+ _PyThreadState_PopCStackRef (tstate , & method_ref );
2346
+ #endif
2342
2347
}
2343
2348
else {
2344
2349
/* meth is not an unbound method (but a regular attr, or
@@ -2347,10 +2352,14 @@ dummy_func(
2347
2352
CALL that it's not a method call.
2348
2353
meth | NULL | arg1 | ... | argN
2349
2354
*/
2350
- attr = method ;
2351
- self_or_null [0 ] = PyStackRef_NULL ;
2352
2355
PyStackRef_CLOSE (owner );
2353
- ERROR_IF (PyStackRef_IsNull (method ));
2356
+ self_or_null [0 ] = PyStackRef_NULL ;
2357
+ attr = method .ref ;
2358
+ #ifdef Py_GIL_DISABLED
2359
+ method_ref .ref = PyStackRef_NULL ;
2360
+ _PyThreadState_PopCStackRef (tstate , & method_ref );
2361
+ #endif
2362
+ ERROR_IF (PyStackRef_IsNull (attr ));
2354
2363
}
2355
2364
}
2356
2365
else {
0 commit comments