diff options
author | Tomas R. <tomas.roun8@gmail.com> | 2025-03-16 17:37:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-16 16:37:29 +0000 |
commit | d07e9ebbe89ce701e73d25777ae057da8dffd506 (patch) | |
tree | 9b1fe3bb3f50ca1590f826d1652773e6cffa0028 | |
parent | bf4c1bf344ed1f80c4e8f4fd5b1a8f0e0858777e (diff) | |
download | cpython-d07e9ebbe89ce701e73d25777ae057da8dffd506.tar.gz cpython-d07e9ebbe89ce701e73d25777ae057da8dffd506.zip |
gh-131306: Remove unused code related to `BINARY_SUBSCR` (#131307)
-rw-r--r-- | Include/cpython/object.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_code.h | 6 | ||||
-rw-r--r-- | InternalDocs/frames.md | 2 | ||||
-rw-r--r-- | Lib/opcode.py | 3 | ||||
-rw-r--r-- | Lib/test/test_opcache.py | 8 |
5 files changed, 6 insertions, 15 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 70cf0b51f14..184aa63b3a5 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -256,7 +256,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; diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index fa0e0bd01c9..c3edbb3dffe 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -120,12 +120,6 @@ typedef struct { typedef struct { _Py_BackoffCounter counter; -} _PyBinarySubscrCache; - -#define INLINE_CACHE_ENTRIES_BINARY_SUBSCR CACHE_ENTRIES(_PyBinarySubscrCache) - -typedef struct { - _Py_BackoffCounter counter; } _PySuperAttrCache; #define INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR CACHE_ENTRIES(_PySuperAttrCache) diff --git a/InternalDocs/frames.md b/InternalDocs/frames.md index aa996dfdf7b..2f0cc7967f3 100644 --- a/InternalDocs/frames.md +++ b/InternalDocs/frames.md @@ -126,7 +126,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 diff --git a/Lib/opcode.py b/Lib/opcode.py index 4ee0d64026b..ea7c27698dd 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -63,9 +63,6 @@ _cache_format = { "CONTAINS_OP": { "counter": 1, }, - "BINARY_SUBSCR": { - "counter": 1, - }, "FOR_ITER": { "counter": 1, }, diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py index 946a4827fe7..ce9c489f32c 100644 --- a/Lib/test/test_opcache.py +++ b/Lib/test/test_opcache.py @@ -1706,7 +1706,7 @@ class TestSpecializer(TestBase): 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): @@ -1717,7 +1717,7 @@ class TestSpecializer(TestBase): 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): @@ -1737,7 +1737,7 @@ class TestSpecializer(TestBase): 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: @@ -1752,7 +1752,7 @@ class TestSpecializer(TestBase): 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 |