Skip to content

Commit 0ab5de9

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-03-13)
Summary: Imported python/cpython `3.15.0a7+` from upstream rev [`0adc728`](https://www.github.com/python/cpython/commit/0adc7289c3ab097b5608c0d288d91e1f5f236469) (committed 2026-03-13 01:53:29+00:00). # Commit Info Base: (`3.15.0a7+`) - [`d19de37`](https://www.github.com/python/cpython/commit/d19de375a204c74ab5f3a28ec42335bae139033d) (commit date: 2026-03-11 21:08:18+00:00) Imported: (`3.15.0a7+`) - [`0adc728`](https://www.github.com/python/cpython/commit/0adc7289c3ab097b5608c0d288d91e1f5f236469) (commit date: 2026-03-13 01:53:29+00:00) # Files added ``` Doc/data/threadsafety.dat Misc/NEWS.d/next/Build/2026-03-11-11-58-42.gh-issue-145801.iCXa3v.rst Misc/NEWS.d/next/Core_and_Builtins/2025-11-02-16-23-17.gh-issue-140594.YIWUpl.rst Misc/NEWS.d/next/Core_and_Builtins/2026-03-10-12-52-06.gh-issue-145685.80B7gK.rst Misc/NEWS.d/next/Library/2026-01-10-16-23-21.gh-issue-143715.HZrfSA.rst Misc/NEWS.d/next/Library/2026-02-11-21-01-30.gh-issue-144259.OAhOR8.rst Misc/NEWS.d/next/Library/2026-03-03-23-21-40.gh-issue-145446.0c-TJX.rst Misc/NEWS.d/next/Library/2026-03-10-01-48-12.gh-issue-145717.dPc0Rt.rst Misc/NEWS.d/next/Windows/2025-10-19-23-44-46.gh-issue-140131.AABF2k.rst ``` Differential Revision: D96427231 fbshipit-source-id: 8fff5233559b1a601a3c49775f092a6bb15a736c
1 parent f1135bb commit 0ab5de9

2 files changed

Lines changed: 23 additions & 24 deletions

File tree

cinderx/Interpreter/3.15/Includes/generated_cases.c.h

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -827,12 +827,10 @@
827827
PyObject *list = PyStackRef_AsPyObjectBorrow(list_st);
828828
assert(PyLong_CheckExact(sub));
829829
assert(PyList_CheckExact(list));
830-
if (!_PyLong_IsNonNegativeCompact((PyLongObject *)sub)) {
831-
UPDATE_MISS_STATS(BINARY_OP);
832-
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
833-
JUMP_TO_PREDICTED(BINARY_OP);
830+
Py_ssize_t index = _PyLong_CompactValue((PyLongObject *)sub);
831+
if (index < 0) {
832+
index += PyList_GET_SIZE(list);
834833
}
835-
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
836834
#ifdef Py_GIL_DISABLED
837835
_PyFrame_SetStackPointer(frame, stack_pointer);
838836
PyObject *res_o = _PyList_GetItemRef((PyListObject*)list, index);
@@ -842,15 +840,13 @@
842840
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
843841
JUMP_TO_PREDICTED(BINARY_OP);
844842
}
845-
STAT_INC(BINARY_OP, hit);
846843
res = PyStackRef_FromPyObjectSteal(res_o);
847844
#else
848-
if (index >= PyList_GET_SIZE(list)) {
845+
if (index < 0 || index >= PyList_GET_SIZE(list)) {
849846
UPDATE_MISS_STATS(BINARY_OP);
850847
assert(_PyOpcode_Deopt[opcode] == (BINARY_OP));
851848
JUMP_TO_PREDICTED(BINARY_OP);
852849
}
853-
STAT_INC(BINARY_OP, hit);
854850
PyObject *res_o = PyList_GET_ITEM(list, index);
855851
assert(res_o != NULL);
856852
res = PyStackRef_FromPyObjectNew(res_o);
@@ -12463,21 +12459,25 @@
1246312459
next_instr += 5;
1246412460
INSTRUCTION_STATS(STORE_ATTR_INSTANCE_VALUE);
1246512461
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
12466-
_PyStackRef owner;
1246712462
_PyStackRef value;
12463+
_PyStackRef owner;
1246812464
_PyStackRef o;
1246912465
/* Skip 1 cache entry */
12470-
// _GUARD_TYPE_VERSION_AND_LOCK
12466+
// _LOCK_OBJECT
1247112467
{
12472-
owner = stack_pointer[-1];
12473-
uint32_t type_version = read_u32(&this_instr[2].cache);
12474-
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
12475-
assert(type_version != 0);
12476-
if (!LOCK_OBJECT(owner_o)) {
12468+
value = stack_pointer[-1];
12469+
if (!LOCK_OBJECT(PyStackRef_AsPyObjectBorrow(value))) {
1247712470
UPDATE_MISS_STATS(STORE_ATTR);
1247812471
assert(_PyOpcode_Deopt[opcode] == (STORE_ATTR));
1247912472
JUMP_TO_PREDICTED(STORE_ATTR);
1248012473
}
12474+
}
12475+
// _GUARD_TYPE_VERSION_LOCKED
12476+
{
12477+
owner = value;
12478+
uint32_t type_version = read_u32(&this_instr[2].cache);
12479+
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
12480+
assert(type_version != 0);
1248112481
PyTypeObject *tp = Py_TYPE(owner_o);
1248212482
if (FT_ATOMIC_LOAD_UINT_RELAXED(tp->tp_version_tag) != type_version) {
1248312483
UNLOCK_OBJECT(owner_o);
@@ -13101,18 +13101,17 @@
1310113101
PyObject *list = PyStackRef_AsPyObjectBorrow(list_st);
1310213102
assert(PyLong_CheckExact(sub));
1310313103
assert(PyList_CheckExact(list));
13104-
if (!_PyLong_IsNonNegativeCompact((PyLongObject *)sub)) {
13105-
UPDATE_MISS_STATS(STORE_SUBSCR);
13106-
assert(_PyOpcode_Deopt[opcode] == (STORE_SUBSCR));
13107-
JUMP_TO_PREDICTED(STORE_SUBSCR);
13108-
}
13109-
Py_ssize_t index = ((PyLongObject*)sub)->long_value.ob_digit[0];
13104+
Py_ssize_t index = _PyLong_CompactValue((PyLongObject *)sub);
1311013105
if (!LOCK_OBJECT(list)) {
1311113106
UPDATE_MISS_STATS(STORE_SUBSCR);
1311213107
assert(_PyOpcode_Deopt[opcode] == (STORE_SUBSCR));
1311313108
JUMP_TO_PREDICTED(STORE_SUBSCR);
1311413109
}
13115-
if (index >= PyList_GET_SIZE(list)) {
13110+
Py_ssize_t len = PyList_GET_SIZE(list);
13111+
if (index < 0) {
13112+
index += len;
13113+
}
13114+
if (index < 0 || index >= len) {
1311613115
UNLOCK_OBJECT(list);
1311713116
if (true) {
1311813117
UPDATE_MISS_STATS(STORE_SUBSCR);

cinderx/UpstreamBorrow/borrowed-3.15.gen_cached.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,8 +2181,8 @@ int init_upstream_borrow(void) {
21812181
MCACHE_HASH(FT_ATOMIC_LOAD_UINT_RELAXED((type)->tp_version_tag), \
21822182
((Py_ssize_t)(name)) >> 3)
21832183
#define MCACHE_CACHEABLE_NAME(name) \
2184-
PyUnicode_CheckExact(name) && \
2185-
(PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE)
2184+
(PyUnicode_CheckExact(name) && \
2185+
(PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE))
21862186
#define NEXT_VERSION_TAG(interp) \
21872187
(interp)->types.next_version_tag
21882188
#ifdef Py_GIL_DISABLED

0 commit comments

Comments
 (0)