@@ -604,6 +604,12 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
604
604
#define SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE 42
605
605
#define SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT 43
606
606
#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
607
613
608
614
/* Calls */
609
615
@@ -2370,6 +2376,14 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
2370
2376
return SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY ;
2371
2377
}
2372
2378
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
+
2373
2387
if (strcmp (container_type -> tp_name , "array.array" ) == 0 ) {
2374
2388
return SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY ;
2375
2389
}
@@ -2390,6 +2404,22 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
2390
2404
return SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY ;
2391
2405
}
2392
2406
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
+
2393
2423
if (PySlice_Check (rhs )) {
2394
2424
return SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE ;
2395
2425
}
0 commit comments