@@ -597,6 +597,13 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
597597#define SPEC_FAIL_BINARY_OP_SUBSCR_TUPLE_SLICE 35
598598#define SPEC_FAIL_BINARY_OP_SUBSCR_STRING_SLICE 36
599599#define SPEC_FAIL_BINARY_OP_SUBSCR_NOT_HEAP_TYPE 37
600+ #define SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE 38
601+ #define SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY 39
602+ #define SPEC_FAIL_BINARY_OP_SUBSCR_RE_MATCH 40
603+ #define SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY 41
604+ #define SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE 42
605+ #define SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT 43
606+ #define SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY 44
600607
601608/* Calls */
602609
@@ -2358,6 +2365,34 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23582365 }
23592366 }
23602367 Py_XDECREF (descriptor );
2368+
2369+ if (PyObject_TypeCheck (lhs , & PyDictProxy_Type )) {
2370+ return SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY ;
2371+ }
2372+
2373+ if (strcmp (container_type -> tp_name , "array.array" ) == 0 ) {
2374+ return SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY ;
2375+ }
2376+
2377+ if (strcmp (container_type -> tp_name , "re.Match" ) == 0 ) {
2378+ return SPEC_FAIL_BINARY_OP_SUBSCR_RE_MATCH ;
2379+ }
2380+
2381+ if (strcmp (container_type -> tp_name , "collections.deque" ) == 0 ) {
2382+ return SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE ;
2383+ }
2384+
2385+ if (strcmp (_PyType_Name (container_type ), "EnumDict" ) != 0 ) {
2386+ return SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT ;
2387+ }
2388+
2389+ if (strcmp (container_type -> tp_name , "StackSummary" ) != 0 ) {
2390+ return SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY ;
2391+ }
2392+
2393+ if (PySlice_Check (rhs )) {
2394+ return SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE ;
2395+ }
23612396 return SPEC_FAIL_BINARY_OP_SUBSCR ;
23622397 }
23632398 Py_UNREACHABLE ();
0 commit comments