Skip to content

Commit d07e9eb

Browse files
authored
gh-131306: Remove unused code related to BINARY_SUBSCR (#131307)
1 parent bf4c1bf commit d07e9eb

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

Include/cpython/object.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ struct _specialization_cache {
256256
// - If getitem is NULL, then getitem_version is meaningless.
257257
// - If getitem->func_version == getitem_version, then getitem can be called
258258
// with two positional arguments and no keyword arguments, and has neither
259-
// *args nor **kwargs (as required by BINARY_SUBSCR_GETITEM):
259+
// *args nor **kwargs (as required by BINARY_OP_SUBSCR_GETITEM):
260260
PyObject *getitem;
261261
uint32_t getitem_version;
262262
PyObject *init;

Include/internal/pycore_code.h

-6
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ typedef struct {
118118

119119
#define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache)
120120

121-
typedef struct {
122-
_Py_BackoffCounter counter;
123-
} _PyBinarySubscrCache;
124-
125-
#define INLINE_CACHE_ENTRIES_BINARY_SUBSCR CACHE_ENTRIES(_PyBinarySubscrCache)
126-
127121
typedef struct {
128122
_Py_BackoffCounter counter;
129123
} _PySuperAttrCache;

InternalDocs/frames.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ to see in an exception traceback.
126126
The `return_offset` field determines where a `RETURN` should go in the caller,
127127
relative to `instr_ptr`. It is only meaningful to the callee, so it needs to
128128
be set in any instruction that implements a call (to a Python function),
129-
including CALL, SEND and BINARY_SUBSCR_GETITEM, among others. If there is no
129+
including CALL, SEND and BINARY_OP_SUBSCR_GETITEM, among others. If there is no
130130
callee, then return_offset is meaningless. It is necessary to have a separate
131131
field for the return offset because (1) if we apply this offset to `instr_ptr`
132132
while executing the `RETURN`, this is too early and would lose us information

Lib/opcode.py

-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@
6363
"CONTAINS_OP": {
6464
"counter": 1,
6565
},
66-
"BINARY_SUBSCR": {
67-
"counter": 1,
68-
},
6966
"FOR_ITER": {
7067
"counter": 1,
7168
},

Lib/test/test_opcache.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ def binary_subscr_list_int():
17061706
binary_subscr_list_int()
17071707
self.assert_specialized(binary_subscr_list_int,
17081708
"BINARY_OP_SUBSCR_LIST_INT")
1709-
self.assert_no_opcode(binary_subscr_list_int, "BINARY_SUBSCR")
1709+
self.assert_no_opcode(binary_subscr_list_int, "BINARY_OP")
17101710

17111711
def binary_subscr_tuple_int():
17121712
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
@@ -1717,7 +1717,7 @@ def binary_subscr_tuple_int():
17171717
binary_subscr_tuple_int()
17181718
self.assert_specialized(binary_subscr_tuple_int,
17191719
"BINARY_OP_SUBSCR_TUPLE_INT")
1720-
self.assert_no_opcode(binary_subscr_tuple_int, "BINARY_SUBSCR")
1720+
self.assert_no_opcode(binary_subscr_tuple_int, "BINARY_OP")
17211721

17221722
def binary_subscr_dict():
17231723
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
@@ -1737,7 +1737,7 @@ def binary_subscr_str_int():
17371737

17381738
binary_subscr_str_int()
17391739
self.assert_specialized(binary_subscr_str_int, "BINARY_OP_SUBSCR_STR_INT")
1740-
self.assert_no_opcode(binary_subscr_str_int, "BINARY_SUBSCR")
1740+
self.assert_no_opcode(binary_subscr_str_int, "BINARY_OP")
17411741

17421742
def binary_subscr_getitems():
17431743
class C:
@@ -1752,7 +1752,7 @@ def __getitem__(self, item):
17521752

17531753
binary_subscr_getitems()
17541754
self.assert_specialized(binary_subscr_getitems, "BINARY_OP_SUBSCR_GETITEM")
1755-
self.assert_no_opcode(binary_subscr_getitems, "BINARY_SUBSCR")
1755+
self.assert_no_opcode(binary_subscr_getitems, "BINARY_OP")
17561756

17571757
@cpython_only
17581758
@requires_specialization_ft

0 commit comments

Comments
 (0)