@@ -836,7 +836,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
836836 return -1 ;
837837 }
838838 /* Don't specialize if PEP 523 is active */
839- if (_PyInterpreterState_GET ()-> eval_frame ) {
839+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
840840 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OTHER );
841841 return -1 ;
842842 }
@@ -920,7 +920,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
920920 return -1 ;
921921 }
922922 /* Don't specialize if PEP 523 is active */
923- if (_PyInterpreterState_GET ()-> eval_frame ) {
923+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
924924 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OTHER );
925925 return -1 ;
926926 }
@@ -1738,7 +1738,7 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17381738 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17391739 int kind = function_kind (code );
17401740 /* Don't specialize if PEP 523 is active */
1741- if (_PyInterpreterState_GET ()-> eval_frame ) {
1741+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17421742 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17431743 return -1 ;
17441744 }
@@ -1781,7 +1781,7 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17811781 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17821782 int kind = function_kind (code );
17831783 /* Don't specialize if PEP 523 is active */
1784- if (_PyInterpreterState_GET ()-> eval_frame ) {
1784+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17851785 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17861786 return -1 ;
17871787 }
@@ -2044,7 +2044,7 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
20442044 return SPEC_FAIL_WRONG_NUMBER_ARGUMENTS ;
20452045 }
20462046
2047- if (_PyInterpreterState_GET ()-> eval_frame ) {
2047+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
20482048 /* Don't specialize if PEP 523 is active */
20492049 Py_DECREF (descriptor );
20502050 return SPEC_FAIL_OTHER ;
@@ -2353,7 +2353,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
23532353 PyHeapTypeObject * ht = (PyHeapTypeObject * )container_type ;
23542354 if (kind == SIMPLE_FUNCTION &&
23552355 fcode -> co_argcount == 2 &&
2356- ! _PyInterpreterState_GET ()-> eval_frame && /* Don't specialize if PEP 523 is active */
2356+ _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) && /* Don't specialize if PEP 523 is active */
23572357 _PyType_CacheGetItemForSpecialization (ht , descriptor , (uint32_t )tp_version ))
23582358 {
23592359 specialize (instr , BINARY_OP_SUBSCR_GETITEM );
@@ -2611,7 +2611,7 @@ _Py_Specialize_ForIter(_PyStackRef iter, _PyStackRef null_or_index, _Py_CODEUNIT
26112611 instr [oparg + INLINE_CACHE_ENTRIES_FOR_ITER + 1 ].op .code == INSTRUMENTED_END_FOR
26122612 );
26132613 /* Don't specialize if PEP 523 is active */
2614- if (_PyInterpreterState_GET ()-> eval_frame ) {
2614+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
26152615 goto failure ;
26162616 }
26172617 specialize (instr , FOR_ITER_GEN );
@@ -2650,7 +2650,7 @@ _Py_Specialize_Send(_PyStackRef receiver_st, _Py_CODEUNIT *instr)
26502650 PyTypeObject * tp = Py_TYPE (receiver );
26512651 if (tp == & PyGen_Type || tp == & PyCoro_Type ) {
26522652 /* Don't specialize if PEP 523 is active */
2653- if (_PyInterpreterState_GET ()-> eval_frame ) {
2653+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
26542654 SPECIALIZATION_FAIL (SEND , SPEC_FAIL_OTHER );
26552655 goto failure ;
26562656 }
@@ -2673,7 +2673,7 @@ _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr)
26732673
26742674 if (Py_TYPE (func ) == & PyFunction_Type &&
26752675 ((PyFunctionObject * )func )-> vectorcall == _PyFunction_Vectorcall ) {
2676- if (_PyInterpreterState_GET ()-> eval_frame ) {
2676+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
26772677 goto failure ;
26782678 }
26792679 specialize (instr , CALL_EX_PY );
0 commit comments