diff options
author | Michael Droettboom <mdboom@gmail.com> | 2024-10-08 13:18:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 13:18:39 -0400 |
commit | c6127af8685c2a9b416207e46089cee79d028b85 (patch) | |
tree | f7547bbcdcf3cf109a026410c4b81cc51b1c7316 /Objects/codeobject.c | |
parent | 7dca7322cca7ff146444e56f28f21f1090987fff (diff) | |
download | cpython-c6127af8685c2a9b416207e46089cee79d028b85.tar.gz cpython-c6127af8685c2a9b416207e46089cee79d028b85.zip |
gh-125063: Emit slices as constants in the bytecode compiler (#125064)
* Make slices marshallable
* Emit slices as constants
* Update Python/marshal.c
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* Refactor codegen_slice into two functions so it
always has the same net effect
* Fix for free-threaded builds
* Simplify marshal loading of slices
* Only return SUCCESS/ERROR from codegen_slice
---------
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 6f0b3f8b9a3..8a2f4d32b91 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -2336,6 +2336,7 @@ _PyCode_ConstantKey(PyObject *op) if (op == Py_None || op == Py_Ellipsis || PyLong_CheckExact(op) || PyUnicode_CheckExact(op) + || PySlice_Check(op) /* code_richcompare() uses _PyCode_ConstantKey() internally */ || PyCode_Check(op)) { |