@@ -838,7 +838,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
838838 return -1 ;
839839 }
840840 /* Don't specialize if PEP 523 is active */
841- if (_PyInterpreterState_GET ()-> eval_frame ) {
841+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
842842 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OTHER );
843843 return -1 ;
844844 }
@@ -922,7 +922,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
922922 return -1 ;
923923 }
924924 /* Don't specialize if PEP 523 is active */
925- if (_PyInterpreterState_GET ()-> eval_frame ) {
925+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
926926 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OTHER );
927927 return -1 ;
928928 }
@@ -1740,7 +1740,7 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17401740 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17411741 int kind = function_kind (code );
17421742 /* Don't specialize if PEP 523 is active */
1743- if (_PyInterpreterState_GET ()-> eval_frame ) {
1743+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17441744 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17451745 return -1 ;
17461746 }
@@ -1783,7 +1783,7 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17831783 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17841784 int kind = function_kind (code );
17851785 /* Don't specialize if PEP 523 is active */
1786- if (_PyInterpreterState_GET ()-> eval_frame ) {
1786+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17871787 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17881788 return -1 ;
17891789 }
@@ -2046,7 +2046,7 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
20462046 return SPEC_FAIL_WRONG_NUMBER_ARGUMENTS ;
20472047 }
20482048
2049- if (_PyInterpreterState_GET ()-> eval_frame ) {
2049+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
20502050 /* Don't specialize if PEP 523 is active */
20512051 Py_DECREF (descriptor );
20522052 return SPEC_FAIL_OTHER ;
@@ -2449,7 +2449,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
24492449 PyHeapTypeObject * ht = (PyHeapTypeObject * )container_type ;
24502450 if (kind == SIMPLE_FUNCTION &&
24512451 fcode -> co_argcount == 2 &&
2452- ! _PyInterpreterState_GET ()-> eval_frame && /* Don't specialize if PEP 523 is active */
2452+ _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) && /* Don't specialize if PEP 523 is active */
24532453 _PyType_CacheGetItemForSpecialization (ht , descriptor , (uint32_t )tp_version ))
24542454 {
24552455 specialize (instr , BINARY_OP_SUBSCR_GETITEM );
@@ -2707,7 +2707,7 @@ _Py_Specialize_ForIter(_PyStackRef iter, _PyStackRef null_or_index, _Py_CODEUNIT
27072707 instr [oparg + INLINE_CACHE_ENTRIES_FOR_ITER + 1 ].op .code == INSTRUMENTED_END_FOR
27082708 );
27092709 /* Don't specialize if PEP 523 is active */
2710- if (_PyInterpreterState_GET ()-> eval_frame ) {
2710+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
27112711 goto failure ;
27122712 }
27132713 specialize (instr , FOR_ITER_GEN );
@@ -2750,7 +2750,7 @@ _Py_Specialize_Send(_PyStackRef receiver_st, _Py_CODEUNIT *instr)
27502750 PyTypeObject * tp = Py_TYPE (receiver );
27512751 if (tp == & PyGen_Type || tp == & PyCoro_Type ) {
27522752 /* Don't specialize if PEP 523 is active */
2753- if (_PyInterpreterState_GET ()-> eval_frame ) {
2753+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
27542754 SPECIALIZATION_FAIL (SEND , SPEC_FAIL_OTHER );
27552755 goto failure ;
27562756 }
@@ -2773,7 +2773,7 @@ _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr)
27732773
27742774 if (Py_TYPE (func ) == & PyFunction_Type &&
27752775 ((PyFunctionObject * )func )-> vectorcall == _PyFunction_Vectorcall ) {
2776- if (_PyInterpreterState_GET ()-> eval_frame ) {
2776+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
27772777 goto failure ;
27782778 }
27792779 specialize (instr , CALL_EX_PY );
0 commit comments