@@ -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 }
@@ -915,7 +915,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
915915 return -1 ;
916916 }
917917 /* Don't specialize if PEP 523 is active */
918- if (_PyInterpreterState_GET ()-> eval_frame ) {
918+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
919919 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OTHER );
920920 return -1 ;
921921 }
@@ -1722,7 +1722,7 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17221722 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17231723 int kind = function_kind (code );
17241724 /* Don't specialize if PEP 523 is active */
1725- if (_PyInterpreterState_GET ()-> eval_frame ) {
1725+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17261726 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17271727 return -1 ;
17281728 }
@@ -1765,7 +1765,7 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
17651765 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
17661766 int kind = function_kind (code );
17671767 /* Don't specialize if PEP 523 is active */
1768- if (_PyInterpreterState_GET ()-> eval_frame ) {
1768+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
17691769 SPECIALIZATION_FAIL (CALL , SPEC_FAIL_CALL_PEP_523 );
17701770 return -1 ;
17711771 }
@@ -2028,7 +2028,7 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
20282028 return SPEC_FAIL_WRONG_NUMBER_ARGUMENTS ;
20292029 }
20302030
2031- if (_PyInterpreterState_GET ()-> eval_frame ) {
2031+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
20322032 /* Don't specialize if PEP 523 is active */
20332033 Py_DECREF (descriptor );
20342034 return SPEC_FAIL_OTHER ;
@@ -2337,7 +2337,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
23372337 PyHeapTypeObject * ht = (PyHeapTypeObject * )container_type ;
23382338 if (kind == SIMPLE_FUNCTION &&
23392339 fcode -> co_argcount == 2 &&
2340- ! _PyInterpreterState_GET ()-> eval_frame && /* Don't specialize if PEP 523 is active */
2340+ _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) && /* Don't specialize if PEP 523 is active */
23412341 _PyType_CacheGetItemForSpecialization (ht , descriptor , (uint32_t )tp_version ))
23422342 {
23432343 specialize (instr , BINARY_OP_SUBSCR_GETITEM );
@@ -2595,7 +2595,7 @@ _Py_Specialize_ForIter(_PyStackRef iter, _PyStackRef null_or_index, _Py_CODEUNIT
25952595 instr [oparg + INLINE_CACHE_ENTRIES_FOR_ITER + 1 ].op .code == INSTRUMENTED_END_FOR
25962596 );
25972597 /* Don't specialize if PEP 523 is active */
2598- if (_PyInterpreterState_GET ()-> eval_frame ) {
2598+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
25992599 goto failure ;
26002600 }
26012601 specialize (instr , FOR_ITER_GEN );
@@ -2634,7 +2634,7 @@ _Py_Specialize_Send(_PyStackRef receiver_st, _Py_CODEUNIT *instr)
26342634 PyTypeObject * tp = Py_TYPE (receiver );
26352635 if (tp == & PyGen_Type || tp == & PyCoro_Type ) {
26362636 /* Don't specialize if PEP 523 is active */
2637- if (_PyInterpreterState_GET ()-> eval_frame ) {
2637+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
26382638 SPECIALIZATION_FAIL (SEND , SPEC_FAIL_OTHER );
26392639 goto failure ;
26402640 }
@@ -2657,7 +2657,7 @@ _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr)
26572657
26582658 if (Py_TYPE (func ) == & PyFunction_Type &&
26592659 ((PyFunctionObject * )func )-> vectorcall == _PyFunction_Vectorcall ) {
2660- if (_PyInterpreterState_GET ()-> eval_frame ) {
2660+ if (! _PyInterpreterState_IsSpecializationEnabled ( _PyInterpreterState_GET ()) ) {
26612661 goto failure ;
26622662 }
26632663 specialize (instr , CALL_EX_PY );
0 commit comments