summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2025-03-28 10:35:20 (GMT)
committerGitHub <noreply@github.com>2025-03-28 10:35:20 (GMT)
commit2c8f329dc634290fb88636f85c05e473bc0104d5 (patch)
treea16e7016315970312b8c61200d8f09573fc5f53b /Python/bytecodes.c
parent674dbf3b3a72bd3d17298c2ead79f32edcff774a (diff)
downloadcpython-2c8f329dc634290fb88636f85c05e473bc0104d5.zip
cpython-2c8f329dc634290fb88636f85c05e473bc0104d5.tar.gz
cpython-2c8f329dc634290fb88636f85c05e473bc0104d5.tar.bz2
gh-131738: optimize builtin any/all/tuple calls with a generator expression arg (#131737)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index b6a4821..b3b7441 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1402,16 +1402,8 @@ dummy_func(
inst(LOAD_COMMON_CONSTANT, ( -- value)) {
// Keep in sync with _common_constants in opcode.py
- // If we ever have more than two constants, use a lookup table
- PyObject *val;
- if (oparg == CONSTANT_ASSERTIONERROR) {
- val = PyExc_AssertionError;
- }
- else {
- assert(oparg == CONSTANT_NOTIMPLEMENTEDERROR);
- val = PyExc_NotImplementedError;
- }
- value = PyStackRef_FromPyObjectImmortal(val);
+ assert(oparg < NUM_COMMON_CONSTANTS);
+ value = PyStackRef_FromPyObjectNew(tstate->interp->common_consts[oparg]);
}
inst(LOAD_BUILD_CLASS, ( -- bc)) {