Skip to content
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
3 changes: 2 additions & 1 deletion Include/internal/pycore_magic_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Known values:
Python 3.14a7 3623 (Add BUILD_INTERPOLATION & BUILD_TEMPLATE opcodes)
Python 3.14b1 3624 (Don't optimize LOAD_FAST when local is killed by DELETE_FAST)
Python 3.15a0 3650 (Initial version)
Python 3.15a1 3651 (Simplify LOAD_CONST)

Python 3.16 will start with 3700

Expand All @@ -290,7 +291,7 @@ PC/launcher.c must also be updated.

*/

#define PYC_MAGIC_NUMBER 3650
#define PYC_MAGIC_NUMBER 3651
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
21 changes: 5 additions & 16 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions Include/internal/pycore_stackref.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,11 @@ _PyStackRef_FromPyObjectSteal(PyObject *obj, const char *filename, int linenumbe
#define PyStackRef_FromPyObjectSteal(obj) _PyStackRef_FromPyObjectSteal(_PyObject_CAST(obj), __FILE__, __LINE__)

static inline _PyStackRef
_PyStackRef_FromPyObjectImmortal(PyObject *obj, const char *filename, int linenumber)
_PyStackRef_FromPyObjectBorrow(PyObject *obj, const char *filename, int linenumber)
{
assert(_Py_IsImmortal(obj));
return _Py_stackref_create(obj, filename, linenumber);
}
#define PyStackRef_FromPyObjectImmortal(obj) _PyStackRef_FromPyObjectImmortal(_PyObject_CAST(obj), __FILE__, __LINE__)
#define PyStackRef_FromPyObjectBorrow(obj) _PyStackRef_FromPyObjectBorrow(_PyObject_CAST(obj), __FILE__, __LINE__)

static inline void
_PyStackRef_CLOSE(_PyStackRef ref, const char *filename, int linenumber)
Expand Down Expand Up @@ -366,15 +365,14 @@ PyStackRef_FromPyObjectNew(PyObject *obj)
#define PyStackRef_FromPyObjectNew(obj) PyStackRef_FromPyObjectNew(_PyObject_CAST(obj))

static inline _PyStackRef
PyStackRef_FromPyObjectImmortal(PyObject *obj)
PyStackRef_FromPyObjectBorrow(PyObject *obj)
{
// Make sure we don't take an already tagged value.
assert(((uintptr_t)obj & Py_TAG_BITS) == 0);
assert(obj != NULL);
assert(_Py_IsImmortal(obj));
return (_PyStackRef){ .bits = (uintptr_t)obj | Py_TAG_DEFERRED };
}
#define PyStackRef_FromPyObjectImmortal(obj) PyStackRef_FromPyObjectImmortal(_PyObject_CAST(obj))
#define PyStackRef_FromPyObjectBorrow(obj) PyStackRef_FromPyObjectBorrow(_PyObject_CAST(obj))

#define PyStackRef_CLOSE(REF) \
do { \
Expand Down Expand Up @@ -582,9 +580,8 @@ _PyStackRef_FromPyObjectNewMortal(PyObject *obj)

/* Create a new reference from an object with an embedded reference count */
static inline _PyStackRef
PyStackRef_FromPyObjectImmortal(PyObject *obj)
PyStackRef_FromPyObjectBorrow(PyObject *obj)
{
assert(_Py_IsImmortal(obj));
return (_PyStackRef){ .bits = (uintptr_t)obj | Py_TAG_REFCNT};
}

Expand Down
2 changes: 0 additions & 2 deletions Include/internal/pycore_uop_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 20 additions & 22 deletions Include/opcode_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 20 additions & 26 deletions Lib/_opcode_metadata.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Lib/test/test_capi/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_is_uniquely_referenced(self):
self.assertTrue(_testcapi.is_uniquely_referenced(object()))
self.assertTrue(_testcapi.is_uniquely_referenced([]))
# Immortals
self.assertFalse(_testcapi.is_uniquely_referenced("spanish inquisition"))
self.assertFalse(_testcapi.is_uniquely_referenced(()))
self.assertFalse(_testcapi.is_uniquely_referenced(42))
# CRASHES is_uniquely_referenced(NULL)

Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ def loop_test():
%3d RESUME_CHECK 0

%3d BUILD_LIST 0
LOAD_CONST_MORTAL 2 ((1, 2, 3))
LOAD_CONST 2 ((1, 2, 3))
LIST_EXTEND 1
LOAD_SMALL_INT 3
BINARY_OP 5 (*)
Expand All @@ -918,7 +918,7 @@ def loop_test():

%3d L2: END_FOR
POP_ITER
LOAD_CONST_IMMORTAL 1 (None)
LOAD_CONST 1 (None)
RETURN_VALUE
""" % (loop_test.__code__.co_firstlineno,
loop_test.__code__.co_firstlineno + 1,
Expand Down Expand Up @@ -1304,7 +1304,7 @@ def test_load_attr_specialize(self):
load_attr_quicken = """\
0 RESUME_CHECK 0

1 LOAD_CONST_IMMORTAL 0 ('a')
1 LOAD_CONST 0 ('a')
LOAD_ATTR_SLOT 0 (__class__)
RETURN_VALUE
"""
Expand Down
14 changes: 0 additions & 14 deletions Lib/test/test_opcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,20 +1810,6 @@ def compare_op_str():
self.assert_specialized(compare_op_str, "COMPARE_OP_STR")
self.assert_no_opcode(compare_op_str, "COMPARE_OP")

@cpython_only
@requires_specialization_ft
def test_load_const(self):
def load_const():
def unused(): pass
# Currently, the empty tuple is immortal, and the otherwise
# unused nested function's code object is mortal. This test will
# have to use different values if either of that changes.
return ()

load_const()
self.assert_specialized(load_const, "LOAD_CONST_IMMORTAL")
self.assert_specialized(load_const, "LOAD_CONST_MORTAL")
self.assert_no_opcode(load_const, "LOAD_CONST")

@cpython_only
@requires_specialization_ft
Expand Down
Loading
Loading