mirror of
https://github.com/python/cpython.git
synced 2025-10-13 18:33:34 +00:00
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>
This commit is contained in:
parent
7dca7322cc
commit
c6127af868
6 changed files with 122 additions and 23 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue