Skip to content

Commit 867b80e

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-03-11)
Summary: Imported python/cpython `3.15.0a7+` from upstream rev [`d19de37`](https://www.github.com/python/cpython/commit/d19de375a204c74ab5f3a28ec42335bae139033d) (committed 2026-03-11 21:08:18+00:00). # Commit Info Base: (`3.15.0a7+`) - [`ebb150e`](https://www.github.com/python/cpython/commit/ebb150e76ab4988fdcd5e8caa36b9014497573a5) (commit date: 2026-03-11 00:43:27+00:00) Imported: (`3.15.0a7+`) - [`d19de37`](https://www.github.com/python/cpython/commit/d19de375a204c74ab5f3a28ec42335bae139033d) (commit date: 2026-03-11 21:08:18+00:00) # Files added ``` Misc/NEWS.d/next/Build/2026-03-08-06-18-26.gh-issue-145633.Ogu-RF.rst Misc/NEWS.d/next/Core_and_Builtins/2026-03-09-00-00-00.gh-issue-145713.KR6azvzI.rst Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-00-13-59.gh-issue-142183.2iVhJH.rst Misc/NEWS.d/next/Library/2025-10-11-11-50-59.gh-issue-139933.05MHlx.rst Misc/NEWS.d/next/Library/2025-11-18-06-35-53.gh-issue-141707.DBmQIy.rst Misc/NEWS.d/next/Library/2026-03-05-14-13-10.gh-issue-145546.3tnlxx.rst Misc/NEWS.d/next/Library/2026-03-07-14-34-39.gh-issue-145587.flFQ5-.rst ``` Differential Revision: D96255196 fbshipit-source-id: d3cc644daea25128b914cfb5727f3ed15e20a11b
1 parent 900f15f commit 867b80e

2 files changed

Lines changed: 126 additions & 75 deletions

File tree

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

Lines changed: 89 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8989,6 +8989,7 @@
89898989
next_instr += 1;
89908990
INSTRUCTION_STATS(INSTRUMENTED_RETURN_VALUE);
89918991
_PyStackRef val;
8992+
_PyStackRef value;
89928993
_PyStackRef retval;
89938994
_PyStackRef res;
89948995
// _RETURN_VALUE_EVENT
@@ -9003,19 +9004,23 @@
90039004
JUMP_TO_LABEL(error);
90049005
}
90059006
}
9007+
// _MAKE_HEAP_SAFE
9008+
{
9009+
value = val;
9010+
value = PyStackRef_MakeHeapSafe(value);
9011+
}
90069012
// _RETURN_VALUE
90079013
{
9008-
retval = val;
9014+
retval = value;
90099015
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
9010-
_PyStackRef temp = PyStackRef_MakeHeapSafe(retval);
9016+
_PyStackRef temp = retval;
90119017
stack_pointer += -1;
90129018
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
90139019
_PyFrame_SetStackPointer(frame, stack_pointer);
90149020
assert(STACK_LEVEL() == 0);
90159021
_Py_LeaveRecursiveCallPy(tstate);
9016-
_PyInterpreterFrame* dying = frame;
9022+
_PyInterpreterFrame *dying = frame;
90179023
frame = tstate->current_frame = dying->previous;
9018-
CI_SET_ADAPTIVE_INTERPRETER_ENABLED_STATE
90199024
_PyEval_FrameClearAndPop(tstate, dying);
90209025
stack_pointer = _PyFrame_GetStackPointer(frame);
90219026
LOAD_IP(frame->return_offset);
@@ -9039,8 +9044,8 @@
90399044
next_instr += 1;
90409045
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
90419046
_PyStackRef val;
9042-
_PyStackRef retval;
90439047
_PyStackRef value;
9048+
_PyStackRef retval;
90449049
// _YIELD_VALUE_EVENT
90459050
{
90469051
val = stack_pointer[-1];
@@ -9057,12 +9062,17 @@
90579062
DISPATCH();
90589063
}
90599064
}
9065+
// _MAKE_HEAP_SAFE
9066+
{
9067+
value = val;
9068+
value = PyStackRef_MakeHeapSafe(value);
9069+
}
90609070
// _YIELD_VALUE
90619071
{
9062-
retval = val;
9072+
retval = value;
90639073
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
90649074
frame->instr_ptr++;
9065-
PyGenObject* gen = _PyGen_GetGeneratorFromFrame(frame);
9075+
PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame);
90669076
assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1);
90679077
assert(oparg == 0 || oparg == 1);
90689078
_PyStackRef temp = retval;
@@ -9072,25 +9082,23 @@
90729082
tstate->exc_info = gen->gi_exc_state.previous_item;
90739083
gen->gi_exc_state.previous_item = NULL;
90749084
_Py_LeaveRecursiveCallPy(tstate);
9075-
_PyInterpreterFrame* gen_frame = frame;
9085+
_PyInterpreterFrame *gen_frame = frame;
90769086
frame = tstate->current_frame = frame->previous;
9077-
CI_SET_ADAPTIVE_INTERPRETER_ENABLED_STATE
90789087
gen_frame->previous = NULL;
90799088
((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD;
90809089
FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg);
90819090
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
90829091
#if TIER_ONE
9083-
assert(
9084-
frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
9085-
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
9086-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
9087-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
9088-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
9089-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
9092+
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
9093+
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
9094+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
9095+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
9096+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
9097+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
90909098
#endif
90919099
stack_pointer = _PyFrame_GetStackPointer(frame);
90929100
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
9093-
value = PyStackRef_MakeHeapSafe(temp);
9101+
value = temp;
90949102
LLTRACE_RESUME_FRAME();
90959103
}
90969104
stack_pointer[0] = value;
@@ -12057,24 +12065,32 @@
1205712065
frame->instr_ptr = next_instr;
1205812066
next_instr += 1;
1205912067
INSTRUCTION_STATS(RETURN_VALUE);
12068+
_PyStackRef value;
1206012069
_PyStackRef retval;
1206112070
_PyStackRef res;
12062-
retval = stack_pointer[-1];
12063-
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
12064-
_PyStackRef temp = PyStackRef_MakeHeapSafe(retval);
12065-
stack_pointer += -1;
12066-
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
12067-
_PyFrame_SetStackPointer(frame, stack_pointer);
12068-
assert(STACK_LEVEL() == 0);
12069-
_Py_LeaveRecursiveCallPy(tstate);
12070-
_PyInterpreterFrame* dying = frame;
12071-
frame = tstate->current_frame = dying->previous;
12072-
CI_SET_ADAPTIVE_INTERPRETER_ENABLED_STATE
12073-
_PyEval_FrameClearAndPop(tstate, dying);
12074-
stack_pointer = _PyFrame_GetStackPointer(frame);
12075-
LOAD_IP(frame->return_offset);
12076-
res = temp;
12077-
LLTRACE_RESUME_FRAME();
12071+
// _MAKE_HEAP_SAFE
12072+
{
12073+
value = stack_pointer[-1];
12074+
value = PyStackRef_MakeHeapSafe(value);
12075+
}
12076+
// _RETURN_VALUE
12077+
{
12078+
retval = value;
12079+
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
12080+
_PyStackRef temp = retval;
12081+
stack_pointer += -1;
12082+
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
12083+
_PyFrame_SetStackPointer(frame, stack_pointer);
12084+
assert(STACK_LEVEL() == 0);
12085+
_Py_LeaveRecursiveCallPy(tstate);
12086+
_PyInterpreterFrame *dying = frame;
12087+
frame = tstate->current_frame = dying->previous;
12088+
_PyEval_FrameClearAndPop(tstate, dying);
12089+
stack_pointer = _PyFrame_GetStackPointer(frame);
12090+
LOAD_IP(frame->return_offset);
12091+
res = temp;
12092+
LLTRACE_RESUME_FRAME();
12093+
}
1207812094
stack_pointer[0] = res;
1207912095
stack_pointer += 1;
1208012096
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
@@ -13890,41 +13906,47 @@
1389013906
frame->instr_ptr = next_instr;
1389113907
next_instr += 1;
1389213908
INSTRUCTION_STATS(YIELD_VALUE);
13893-
_PyStackRef retval;
1389413909
_PyStackRef value;
13895-
retval = stack_pointer[-1];
13896-
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
13897-
frame->instr_ptr++;
13898-
PyGenObject* gen = _PyGen_GetGeneratorFromFrame(frame);
13899-
assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1);
13900-
assert(oparg == 0 || oparg == 1);
13901-
_PyStackRef temp = retval;
13902-
stack_pointer += -1;
13903-
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
13904-
_PyFrame_SetStackPointer(frame, stack_pointer);
13905-
tstate->exc_info = gen->gi_exc_state.previous_item;
13906-
gen->gi_exc_state.previous_item = NULL;
13907-
_Py_LeaveRecursiveCallPy(tstate);
13908-
_PyInterpreterFrame* gen_frame = frame;
13909-
frame = tstate->current_frame = frame->previous;
13910-
CI_SET_ADAPTIVE_INTERPRETER_ENABLED_STATE
13911-
gen_frame->previous = NULL;
13912-
((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD;
13913-
FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg);
13914-
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
13915-
#if TIER_ONE
13916-
assert(
13917-
frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
13918-
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
13919-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
13920-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
13921-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
13922-
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
13923-
#endif
13924-
stack_pointer = _PyFrame_GetStackPointer(frame);
13925-
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
13926-
value = PyStackRef_MakeHeapSafe(temp);
13927-
LLTRACE_RESUME_FRAME();
13910+
_PyStackRef retval;
13911+
// _MAKE_HEAP_SAFE
13912+
{
13913+
value = stack_pointer[-1];
13914+
value = PyStackRef_MakeHeapSafe(value);
13915+
}
13916+
// _YIELD_VALUE
13917+
{
13918+
retval = value;
13919+
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
13920+
frame->instr_ptr++;
13921+
PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame);
13922+
assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1);
13923+
assert(oparg == 0 || oparg == 1);
13924+
_PyStackRef temp = retval;
13925+
stack_pointer += -1;
13926+
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
13927+
_PyFrame_SetStackPointer(frame, stack_pointer);
13928+
tstate->exc_info = gen->gi_exc_state.previous_item;
13929+
gen->gi_exc_state.previous_item = NULL;
13930+
_Py_LeaveRecursiveCallPy(tstate);
13931+
_PyInterpreterFrame *gen_frame = frame;
13932+
frame = tstate->current_frame = frame->previous;
13933+
gen_frame->previous = NULL;
13934+
((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD;
13935+
FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg);
13936+
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
13937+
#if TIER_ONE
13938+
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
13939+
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
13940+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
13941+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
13942+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
13943+
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
13944+
#endif
13945+
stack_pointer = _PyFrame_GetStackPointer(frame);
13946+
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
13947+
value = temp;
13948+
LLTRACE_RESUME_FRAME();
13949+
}
1392813950
stack_pointer[0] = value;
1392913951
stack_pointer += 1;
1393013952
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);

cinderx/UpstreamBorrow/borrowed-3.15.gen_cached.c

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ _PyInterpreterState_GetConfig(PyInterpreterState *interp)
301301
#ifdef Py_GIL_DISABLED
302302
#else
303303
#endif
304+
#define frozendict_does_not_support(WHAT) \
305+
PyErr_SetString(PyExc_TypeError, "frozendict object does " \
306+
"not support item " WHAT)
304307
#ifdef Py_GIL_DISABLED
305308
#else
306309
#endif
@@ -1520,13 +1523,18 @@ setitem_lock_held(PyDictObject *mp, PyObject *key, PyObject *value)
15201523
int
15211524
_PyDict_DelItem_KnownHash_LockHeld(PyObject *op, PyObject *key, Py_hash_t hash)
15221525
{
1523-
Py_ssize_t ix;
1524-
PyObject *old_value;
1525-
15261526
if (!PyDict_Check(op)) {
1527-
PyErr_BadInternalCall();
1527+
if (PyFrozenDict_Check(op)) {
1528+
frozendict_does_not_support("deletion");
1529+
}
1530+
else {
1531+
PyErr_BadInternalCall();
1532+
}
15281533
return -1;
15291534
}
1535+
1536+
Py_ssize_t ix;
1537+
PyObject *old_value;
15301538
PyDictObject *mp = (PyDictObject *)op;
15311539
assert(can_modify_dict(mp));
15321540

@@ -1548,7 +1556,17 @@ int
15481556
_PyDict_SetItem_LockHeld(PyDictObject *dict, PyObject *name, PyObject *value)
15491557
{
15501558
if (!PyDict_Check(dict)) {
1551-
PyErr_BadInternalCall();
1559+
if (PyFrozenDict_Check(dict)) {
1560+
if (value == NULL) {
1561+
frozendict_does_not_support("deletion");
1562+
}
1563+
else {
1564+
frozendict_does_not_support("assignment");
1565+
}
1566+
}
1567+
else {
1568+
PyErr_BadInternalCall();
1569+
}
15521570
return -1;
15531571
}
15541572

@@ -3210,9 +3228,20 @@ push_chunk(PyThreadState *tstate, int size)
32103228
while (allocate_size < (int)sizeof(PyObject*)*(size + MINIMUM_OVERHEAD)) {
32113229
allocate_size *= 2;
32123230
}
3213-
_PyStackChunk *new = allocate_chunk(allocate_size, tstate->datastack_chunk);
3214-
if (new == NULL) {
3215-
return NULL;
3231+
_PyStackChunk *new;
3232+
if (tstate->datastack_cached_chunk != NULL
3233+
&& (size_t)allocate_size <= tstate->datastack_cached_chunk->size)
3234+
{
3235+
new = tstate->datastack_cached_chunk;
3236+
tstate->datastack_cached_chunk = NULL;
3237+
new->previous = tstate->datastack_chunk;
3238+
new->top = 0;
3239+
}
3240+
else {
3241+
new = allocate_chunk(allocate_size, tstate->datastack_chunk);
3242+
if (new == NULL) {
3243+
return NULL;
3244+
}
32163245
}
32173246
if (tstate->datastack_chunk) {
32183247
tstate->datastack_chunk->top = tstate->datastack_top -

0 commit comments

Comments
 (0)