@@ -551,11 +551,8 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
551551#define SPEC_FAIL_SUBSCR_ARRAY_INT 9
552552#define SPEC_FAIL_SUBSCR_ARRAY_SLICE 10
553553#define SPEC_FAIL_SUBSCR_LIST_SLICE 11
554- #define SPEC_FAIL_SUBSCR_TUPLE_SLICE 12
555- #define SPEC_FAIL_SUBSCR_STRING_SLICE 14
556- #define SPEC_FAIL_SUBSCR_BUFFER_INT 15
557- #define SPEC_FAIL_SUBSCR_BUFFER_SLICE 16
558- #define SPEC_FAIL_SUBSCR_SEQUENCE_INT 17
554+ #define SPEC_FAIL_SUBSCR_BUFFER_INT 12
555+ #define SPEC_FAIL_SUBSCR_BUFFER_SLICE 13
559556
560557/* Store subscr */
561558#define SPEC_FAIL_SUBSCR_BYTEARRAY_INT 18
@@ -592,6 +589,10 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
592589#define SPEC_FAIL_BINARY_OP_XOR_INT 31
593590#define SPEC_FAIL_BINARY_OP_XOR_DIFFERENT_TYPES 32
594591#define SPEC_FAIL_BINARY_OP_SUBSCR 33
592+ #define SPEC_FAIL_BINARY_OP_SUBSCR_LIST_SLICE 34
593+ #define SPEC_FAIL_BINARY_OP_SUBSCR_TUPLE_SLICE 35
594+ #define SPEC_FAIL_BINARY_OP_SUBSCR_STRING_SLICE 36
595+ #define SPEC_FAIL_BINARY_OP_SUBSCR_NOT_HEAP_TYPE 37
595596
596597/* Calls */
597598
@@ -1760,37 +1761,6 @@ _Py_Specialize_LoadGlobal(
17601761 Py_END_CRITICAL_SECTION2 ();
17611762}
17621763
1763- #ifdef Py_STATS
1764- static int
1765- binary_subscr_fail_kind (PyTypeObject * container_type , PyObject * sub )
1766- {
1767- if (strcmp (container_type -> tp_name , "array.array" ) == 0 ) {
1768- if (PyLong_CheckExact (sub )) {
1769- return SPEC_FAIL_SUBSCR_ARRAY_INT ;
1770- }
1771- if (PySlice_Check (sub )) {
1772- return SPEC_FAIL_SUBSCR_ARRAY_SLICE ;
1773- }
1774- return SPEC_FAIL_OTHER ;
1775- }
1776- else if (container_type -> tp_as_buffer ) {
1777- if (PyLong_CheckExact (sub )) {
1778- return SPEC_FAIL_SUBSCR_BUFFER_INT ;
1779- }
1780- if (PySlice_Check (sub )) {
1781- return SPEC_FAIL_SUBSCR_BUFFER_SLICE ;
1782- }
1783- return SPEC_FAIL_OTHER ;
1784- }
1785- else if (container_type -> tp_as_sequence ) {
1786- if (PyLong_CheckExact (sub ) && container_type -> tp_as_sequence -> sq_item ) {
1787- return SPEC_FAIL_SUBSCR_SEQUENCE_INT ;
1788- }
1789- }
1790- return SPEC_FAIL_OTHER ;
1791- }
1792- #endif // Py_STATS
1793-
17941764static int
17951765function_kind (PyCodeObject * code ) {
17961766 int flags = code -> co_flags ;
@@ -2335,23 +2305,23 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23352305 return SPEC_FAIL_OUT_OF_RANGE ;
23362306 }
23372307 if (PySlice_Check (rhs )) {
2338- return SPEC_FAIL_SUBSCR_LIST_SLICE ;
2308+ return SPEC_FAIL_BINARY_OP_SUBSCR_LIST_SLICE ;
23392309 }
23402310 }
23412311 if (PyTuple_CheckExact (lhs )) {
23422312 if (PyLong_CheckExact (rhs ) && !_PyLong_IsNonNegativeCompact ((PyLongObject * )rhs )) {
23432313 return SPEC_FAIL_OUT_OF_RANGE ;
23442314 }
23452315 if (PySlice_Check (rhs )) {
2346- return SPEC_FAIL_SUBSCR_TUPLE_SLICE ;
2316+ return SPEC_FAIL_BINARY_OP_SUBSCR_TUPLE_SLICE ;
23472317 }
23482318 }
23492319 if (PyUnicode_CheckExact (lhs )) {
23502320 if (PyLong_CheckExact (rhs ) && !_PyLong_IsNonNegativeCompact ((PyLongObject * )rhs )) {
23512321 return SPEC_FAIL_OUT_OF_RANGE ;
23522322 }
23532323 if (PySlice_Check (rhs )) {
2354- return SPEC_FAIL_SUBSCR_STRING_SLICE ;
2324+ return SPEC_FAIL_BINARY_OP_SUBSCR_STRING_SLICE ;
23552325 }
23562326 }
23572327 unsigned int tp_version ;
@@ -2360,7 +2330,7 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23602330 if (descriptor && Py_TYPE (descriptor ) == & PyFunction_Type ) {
23612331 if (!(container_type -> tp_flags & Py_TPFLAGS_HEAPTYPE )) {
23622332 Py_DECREF (descriptor );
2363- return SPEC_FAIL_SUBSCR_NOT_HEAP_TYPE ;
2333+ return SPEC_FAIL_BINARY_OP_SUBSCR_NOT_HEAP_TYPE ;
23642334 }
23652335 PyFunctionObject * func = (PyFunctionObject * )descriptor ;
23662336 PyCodeObject * fcode = (PyCodeObject * )func -> func_code ;
0 commit comments