Skip to content

gh-131306: Remove unused code related to BINARY_SUBSCR #131307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Include/cpython/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ struct _specialization_cache {
// - If getitem is NULL, then getitem_version is meaningless.
// - If getitem->func_version == getitem_version, then getitem can be called
// with two positional arguments and no keyword arguments, and has neither
// *args nor **kwargs (as required by BINARY_SUBSCR_GETITEM):
// *args nor **kwargs (as required by BINARY_OP_SUBSCR_GETITEM):
PyObject *getitem;
uint32_t getitem_version;
PyObject *init;
Expand Down
6 changes: 0 additions & 6 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ typedef struct {

#define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache)

typedef struct {
_Py_BackoffCounter counter;
} _PyBinarySubscrCache;

#define INLINE_CACHE_ENTRIES_BINARY_SUBSCR CACHE_ENTRIES(_PyBinarySubscrCache)

typedef struct {
_Py_BackoffCounter counter;
} _PySuperAttrCache;
Expand Down
2 changes: 1 addition & 1 deletion InternalDocs/frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ to see in an exception traceback.
The `return_offset` field determines where a `RETURN` should go in the caller,
relative to `instr_ptr`. It is only meaningful to the callee, so it needs to
be set in any instruction that implements a call (to a Python function),
including CALL, SEND and BINARY_SUBSCR_GETITEM, among others. If there is no
including CALL, SEND and BINARY_OP_SUBSCR_GETITEM, among others. If there is no
callee, then return_offset is meaningless. It is necessary to have a separate
field for the return offset because (1) if we apply this offset to `instr_ptr`
while executing the `RETURN`, this is too early and would lose us information
Expand Down
3 changes: 0 additions & 3 deletions Lib/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
"CONTAINS_OP": {
"counter": 1,
},
"BINARY_SUBSCR": {
"counter": 1,
},
"FOR_ITER": {
"counter": 1,
},
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_opcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ def binary_subscr_list_int():
binary_subscr_list_int()
self.assert_specialized(binary_subscr_list_int,
"BINARY_OP_SUBSCR_LIST_INT")
self.assert_no_opcode(binary_subscr_list_int, "BINARY_SUBSCR")
self.assert_no_opcode(binary_subscr_list_int, "BINARY_OP")

def binary_subscr_tuple_int():
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
Expand All @@ -1717,7 +1717,7 @@ def binary_subscr_tuple_int():
binary_subscr_tuple_int()
self.assert_specialized(binary_subscr_tuple_int,
"BINARY_OP_SUBSCR_TUPLE_INT")
self.assert_no_opcode(binary_subscr_tuple_int, "BINARY_SUBSCR")
self.assert_no_opcode(binary_subscr_tuple_int, "BINARY_OP")

def binary_subscr_dict():
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
Expand All @@ -1737,7 +1737,7 @@ def binary_subscr_str_int():

binary_subscr_str_int()
self.assert_specialized(binary_subscr_str_int, "BINARY_OP_SUBSCR_STR_INT")
self.assert_no_opcode(binary_subscr_str_int, "BINARY_SUBSCR")
self.assert_no_opcode(binary_subscr_str_int, "BINARY_OP")

def binary_subscr_getitems():
class C:
Expand All @@ -1752,7 +1752,7 @@ def __getitem__(self, item):

binary_subscr_getitems()
self.assert_specialized(binary_subscr_getitems, "BINARY_OP_SUBSCR_GETITEM")
self.assert_no_opcode(binary_subscr_getitems, "BINARY_SUBSCR")
self.assert_no_opcode(binary_subscr_getitems, "BINARY_OP")

@cpython_only
@requires_specialization_ft
Expand Down
Loading