@@ -604,6 +604,12 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
604604#define SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE 42
605605#define SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT 43
606606#define SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY 44
607+ #define SPEC_FAIL_BINARY_OP_SUBSCR_DEFAULTDICT 45
608+ #define SPEC_FAIL_BINARY_OP_SUBSCR_COUNTER 46
609+ #define SPEC_FAIL_BINARY_OP_SUBSCR_ORDEREDDICT 47
610+ #define SPEC_FAIL_BINARY_OP_SUBSCR_BYTES 48
611+ #define SPEC_FAIL_BINARY_OP_SUBSCR_STRUCTTIME 49
612+ #define SPEC_FAIL_BINARY_OP_SUBSCR_RANGE 50
607613
608614/* Calls */
609615
@@ -2370,6 +2376,14 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23702376 return SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY ;
23712377 }
23722378
2379+ if (PyObject_TypeCheck (lhs , & PyBytes_Type )) {
2380+ return SPEC_FAIL_BINARY_OP_SUBSCR_BYTES ;
2381+ }
2382+
2383+ if (PyObject_TypeCheck (lhs , & PyRange_Type )) {
2384+ return SPEC_FAIL_BINARY_OP_SUBSCR_RANGE ;
2385+ }
2386+
23732387 if (strcmp (container_type -> tp_name , "array.array" ) == 0 ) {
23742388 return SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY ;
23752389 }
@@ -2390,6 +2404,22 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23902404 return SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY ;
23912405 }
23922406
2407+ if (strcmp (container_type -> tp_name , "collections.defaultdict" ) == 0 ) {
2408+ return SPEC_FAIL_BINARY_OP_SUBSCR_DEFAULTDICT ;
2409+ }
2410+
2411+ if (strcmp (container_type -> tp_name , "Counter" ) == 0 ) {
2412+ return SPEC_FAIL_BINARY_OP_SUBSCR_COUNTER ;
2413+ }
2414+
2415+ if (strcmp (container_type -> tp_name , "collections.OrderedDict" ) == 0 ) {
2416+ return SPEC_FAIL_BINARY_OP_SUBSCR_ORDEREDDICT ;
2417+ }
2418+
2419+ if (strcmp (container_type -> tp_name , "time.struct_time" ) == 0 ) {
2420+ return SPEC_FAIL_BINARY_OP_SUBSCR_STRUCTTIME ;
2421+ }
2422+
23932423 if (PySlice_Check (rhs )) {
23942424 return SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE ;
23952425 }
0 commit comments