@@ -782,16 +782,22 @@ PyStackRef_LongCheck(_PyStackRef stackref)
782782 return PyLong_Check (PyStackRef_AsPyObjectBorrow (stackref ));
783783}
784784
785+ #ifdef Py_GIL_DISABLED
785786static inline void
786787_PyThreadState_PushCStackRef (PyThreadState * tstate , _PyCStackRef * ref )
787788{
788- #ifdef Py_GIL_DISABLED
789789 _PyThreadStateImpl * tstate_impl = (_PyThreadStateImpl * )tstate ;
790790 ref -> next = tstate_impl -> c_stack_refs ;
791791 tstate_impl -> c_stack_refs = ref ;
792- #endif
793792 ref -> ref = PyStackRef_NULL ;
794793}
794+ #else
795+ static inline void
796+ _PyThreadState_PushCStackRef (PyThreadState * Py_UNUSED (tstate ), _PyCStackRef * ref )
797+ {
798+ ref -> ref = PyStackRef_NULL ;
799+ }
800+ #endif
795801
796802static inline void
797803_PyThreadState_PushCStackRefNew (PyThreadState * tstate , _PyCStackRef * ref , PyObject * obj )
@@ -800,27 +806,39 @@ _PyThreadState_PushCStackRefNew(PyThreadState *tstate, _PyCStackRef *ref, PyObje
800806 ref -> ref = PyStackRef_FromPyObjectNew (obj );
801807}
802808
809+
810+ #ifdef Py_GIL_DISABLED
803811static inline void
804812_PyThreadState_PopCStackRef (PyThreadState * tstate , _PyCStackRef * ref )
805813{
806- #ifdef Py_GIL_DISABLED
807814 _PyThreadStateImpl * tstate_impl = (_PyThreadStateImpl * )tstate ;
808815 assert (tstate_impl -> c_stack_refs == ref );
809816 tstate_impl -> c_stack_refs = ref -> next ;
810- #endif
811817 PyStackRef_XCLOSE (ref -> ref );
812818}
813819
814820static inline _PyStackRef
815821_PyThreadState_PopCStackRefSteal (PyThreadState * tstate , _PyCStackRef * ref )
816822{
817- #ifdef Py_GIL_DISABLED
818823 _PyThreadStateImpl * tstate_impl = (_PyThreadStateImpl * )tstate ;
819824 assert (tstate_impl -> c_stack_refs == ref );
820825 tstate_impl -> c_stack_refs = ref -> next ;
821- #endif
822826 return ref -> ref ;
823827}
828+ #else
829+ static inline void
830+ _PyThreadState_PopCStackRef (PyThreadState * Py_UNUSED (tstate ), _PyCStackRef * ref )
831+ {
832+ PyStackRef_XCLOSE (ref -> ref );
833+ }
834+
835+ static inline _PyStackRef
836+ _PyThreadState_PopCStackRefSteal (PyThreadState * Py_UNUSED (tstate ), _PyCStackRef * ref )
837+ {
838+ return ref -> ref ;
839+ }
840+ #endif
841+
824842
825843#ifdef Py_GIL_DISABLED
826844
0 commit comments