Skip to content

Commit d219116

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-03-17)
Summary: Imported python/cpython `3.15.0a7+` from upstream rev [`1b11835`](https://www.github.com/python/cpython/commit/1b118353bb0a9d816de6ef673f3b11775de5bec5) (committed 2026-03-17 01:39:45+00:00). # Commit Info Base: (`3.15.0a7+`) - [`40095d5`](https://www.github.com/python/cpython/commit/40095d526bd8ddbabee0603c2b502ed6807e5f4d) (commit date: 2026-03-15 23:54:20+00:00) Imported: (`3.15.0a7+`) - [`1b11835`](https://www.github.com/python/cpython/commit/1b118353bb0a9d816de6ef673f3b11775de5bec5) (commit date: 2026-03-17 01:39:45+00:00) # Files added ``` Misc/NEWS.d/next/Core_and_Builtins/2026-03-13-09-48-57.gh-issue-127958.U-znTv.rst Misc/NEWS.d/next/Documentation/2026-03-09-00-00-00.gh-issue-145649.8BcbAB.rst Misc/NEWS.d/next/Library/2026-02-04-20-30-59.gh-issue-123471.1dnPvs.rst Misc/NEWS.d/next/Library/2026-02-08-22-04-06.gh-issue-140814.frzSpn.rst Misc/NEWS.d/next/Library/2026-02-19-12-00-00.gh-issue-144984.b93995c982.rst Misc/NEWS.d/next/Security/2026-03-06-17-03-38.gh-issue-145599.kchwZV.rst Platforms/emscripten/README.md Platforms/emscripten/__main__.py Platforms/emscripten/browser_test/.gitignore Platforms/emscripten/browser_test/index.spec.ts Platforms/emscripten/browser_test/package-lock.json Platforms/emscripten/browser_test/package.json Platforms/emscripten/browser_test/playwright.config.ts Platforms/emscripten/browser_test/run_test.sh Platforms/emscripten/config.site-wasm32-emscripten Platforms/emscripten/config.toml Platforms/emscripten/make_libffi.sh Platforms/emscripten/node_entry.mjs Platforms/emscripten/prepare_external_wasm.py Platforms/emscripten/wasm_assets.py Platforms/emscripten/web_example/index.html Platforms/emscripten/web_example/python.worker.mjs Platforms/emscripten/web_example/server.py Platforms/emscripten/web_example_pyrepl_jspi/index.html Platforms/emscripten/web_example_pyrepl_jspi/src.mjs ``` # Files removed ``` Lib/test/test_pyrepl/eio_test_script.py Tools/wasm/README.md Tools/wasm/emscripten/browser_test/.gitignore Tools/wasm/emscripten/browser_test/index.spec.ts Tools/wasm/emscripten/browser_test/package-lock.json Tools/wasm/emscripten/browser_test/package.json Tools/wasm/emscripten/browser_test/playwright.config.ts Tools/wasm/emscripten/config.site-wasm32-emscripten Tools/wasm/emscripten/config.toml Tools/wasm/emscripten/make_libffi.sh Tools/wasm/emscripten/node_entry.mjs Tools/wasm/emscripten/prepare_external_wasm.py Tools/wasm/emscripten/wasm_assets.py Tools/wasm/emscripten/web_example/index.html Tools/wasm/emscripten/web_example/python.worker.mjs Tools/wasm/emscripten/web_example/server.py Tools/wasm/emscripten/web_example_pyrepl_jspi/index.html Tools/wasm/emscripten/web_example_pyrepl_jspi/src.mjs ``` Differential Revision: D96875089 fbshipit-source-id: f31be445a26f6fa8c5e71f4eb783c2a904f50cd9
1 parent 694506d commit d219116

3 files changed

Lines changed: 127 additions & 37 deletions

File tree

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

Lines changed: 121 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,23 +2988,28 @@
29882988
INSTRUCTION_STATS(CALL_INTRINSIC_1);
29892989
_PyStackRef value;
29902990
_PyStackRef res;
2991-
value = stack_pointer[-1];
2992-
assert(oparg <= MAX_INTRINSIC_1);
2993-
_PyFrame_SetStackPointer(frame, stack_pointer);
2994-
PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value));
2995-
stack_pointer = _PyFrame_GetStackPointer(frame);
2996-
stack_pointer += -1;
2997-
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
2998-
_PyFrame_SetStackPointer(frame, stack_pointer);
2999-
PyStackRef_CLOSE(value);
3000-
stack_pointer = _PyFrame_GetStackPointer(frame);
3001-
if (res_o == NULL) {
3002-
JUMP_TO_LABEL(error);
2991+
_PyStackRef v;
2992+
// _CALL_INTRINSIC_1
2993+
{
2994+
value = stack_pointer[-1];
2995+
assert(oparg <= MAX_INTRINSIC_1);
2996+
_PyFrame_SetStackPointer(frame, stack_pointer);
2997+
PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value));
2998+
stack_pointer = _PyFrame_GetStackPointer(frame);
2999+
if (res_o == NULL) {
3000+
JUMP_TO_LABEL(error);
3001+
}
3002+
v = value;
3003+
res = PyStackRef_FromPyObjectSteal(res_o);
3004+
}
3005+
// _POP_TOP
3006+
{
3007+
value = v;
3008+
stack_pointer[-1] = res;
3009+
_PyFrame_SetStackPointer(frame, stack_pointer);
3010+
PyStackRef_XCLOSE(value);
3011+
stack_pointer = _PyFrame_GetStackPointer(frame);
30033012
}
3004-
res = PyStackRef_FromPyObjectSteal(res_o);
3005-
stack_pointer[0] = res;
3006-
stack_pointer += 1;
3007-
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
30083013
DISPATCH();
30093014
}
30103015

@@ -5696,12 +5701,22 @@
56965701
INSTRUCTION_STATS(ENTER_EXECUTOR);
56975702
opcode = ENTER_EXECUTOR;
56985703
#ifdef _Py_TIER2
5704+
PyCodeObject *code = _PyFrame_GetCode(frame);
5705+
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
56995706
if (IS_JIT_TRACING()) {
5707+
int og_opcode = executor->vm_data.opcode;
5708+
int og_oparg = (oparg & ~255) | executor->vm_data.oparg;
57005709
next_instr = this_instr;
5710+
if (_PyJit_EnterExecutorShouldStopTracing(og_opcode)) {
5711+
if (_PyOpcode_Caches[_PyOpcode_Deopt[opcode]]) {
5712+
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
5713+
}
5714+
opcode = og_opcode;
5715+
oparg = og_oparg;
5716+
DISPATCH_GOTO_NON_TRACING();
5717+
}
57015718
JUMP_TO_LABEL(stop_tracing);
57025719
}
5703-
PyCodeObject *code = _PyFrame_GetCode(frame);
5704-
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
57055720
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
57065721
assert(executor->vm_data.code == code);
57075722
assert(executor->vm_data.valid);
@@ -8902,8 +8917,9 @@
89028917
_Py_CODEUNIT* const this_instr = next_instr;
89038918
(void)this_instr;
89048919
frame->instr_ptr = next_instr;
8905-
next_instr += 1;
8920+
next_instr += 2;
89068921
INSTRUCTION_STATS(INSTRUMENTED_RESUME);
8922+
/* Skip 1 cache entry */
89078923
// _LOAD_BYTECODE
89088924
{
89098925
#ifdef Py_GIL_DISABLED
@@ -9251,16 +9267,19 @@
92519267
// _JIT
92529268
{
92539269
#ifdef _Py_TIER2
9270+
bool is_resume = this_instr->op.code == RESUME_CHECK_JIT;
92549271
_Py_BackoffCounter counter = this_instr[1].counter;
9255-
if (!IS_JIT_TRACING() && backoff_counter_triggers(counter) &&
9256-
this_instr->op.code == JUMP_BACKWARD_JIT &&
9272+
if ((backoff_counter_triggers(counter) &&
9273+
!IS_JIT_TRACING() &&
9274+
(this_instr->op.code == JUMP_BACKWARD_JIT || is_resume)) &&
92579275
next_instr->op.code != ENTER_EXECUTOR) {
92589276
_Py_CODEUNIT *insert_exec_at = this_instr;
92599277
while (oparg > 255) {
92609278
oparg >>= 8;
92619279
insert_exec_at--;
92629280
}
9263-
int succ = _PyJit_TryInitializeTracing(tstate, frame, this_instr, insert_exec_at, next_instr, stack_pointer, 0, NULL, oparg, NULL);
9281+
int succ = _PyJit_TryInitializeTracing(tstate, frame, this_instr, insert_exec_at,
9282+
is_resume ? insert_exec_at : next_instr, stack_pointer, 0, NULL, oparg, NULL);
92649283
if (succ) {
92659284
ENTER_TRACING();
92669285
}
@@ -11925,10 +11944,10 @@
1192511944
(void)(opcode);
1192611945
#endif
1192711946
frame->instr_ptr = next_instr;
11928-
next_instr += 1;
11947+
next_instr += 2;
1192911948
INSTRUCTION_STATS(RESUME);
1193011949
PREDICTED_RESUME:;
11931-
_Py_CODEUNIT* const this_instr = next_instr - 1;
11950+
_Py_CODEUNIT* const this_instr = next_instr - 2;
1193211951
(void)this_instr;
1193311952
// _LOAD_BYTECODE
1193411953
{
@@ -11975,11 +11994,11 @@
1197511994
}
1197611995
// _QUICKEN_RESUME
1197711996
{
11978-
#if ENABLE_SPECIALIZATION
11979-
if (tstate->tracing == 0 && this_instr->op.code == RESUME) {
11980-
FT_ATOMIC_STORE_UINT8_RELAXED(this_instr->op.code, RESUME_CHECK);
11981-
}
11982-
#endif /* ENABLE_SPECIALIZATION */
11997+
uint16_t counter = read_u16(&this_instr[1].cache);
11998+
(void)counter;
11999+
_PyFrame_SetStackPointer(frame, stack_pointer);
12000+
_Py_Specialize_Resume(this_instr, tstate, frame);
12001+
stack_pointer = _PyFrame_GetStackPointer(frame);
1198312002
}
1198412003
// _CHECK_PERIODIC_IF_NOT_YIELD_FROM
1198512004
{
@@ -12003,9 +12022,10 @@
1200312022
_Py_CODEUNIT* const this_instr = next_instr;
1200412023
(void)this_instr;
1200512024
frame->instr_ptr = next_instr;
12006-
next_instr += 1;
12025+
next_instr += 2;
1200712026
INSTRUCTION_STATS(RESUME_CHECK);
12008-
static_assert(0 == 0, "incorrect cache size");
12027+
static_assert(1 == 1, "incorrect cache size");
12028+
/* Skip 1 cache entry */
1200912029
#if defined(__EMSCRIPTEN__)
1201012030
if (_Py_emscripten_signal_clock == 0) {
1201112031
UPDATE_MISS_STATS(RESUME);
@@ -12033,6 +12053,76 @@
1203312053
DISPATCH();
1203412054
}
1203512055

12056+
TARGET(RESUME_CHECK_JIT) {
12057+
#if _Py_TAIL_CALL_INTERP
12058+
int opcode = RESUME_CHECK_JIT;
12059+
(void)(opcode);
12060+
#endif
12061+
_Py_CODEUNIT* const this_instr = next_instr;
12062+
(void)this_instr;
12063+
frame->instr_ptr = next_instr;
12064+
next_instr += 2;
12065+
INSTRUCTION_STATS(RESUME_CHECK_JIT);
12066+
static_assert(1 == 1, "incorrect cache size");
12067+
/* Skip 1 cache entry */
12068+
// _RESUME_CHECK
12069+
{
12070+
#if defined(__EMSCRIPTEN__)
12071+
if (_Py_emscripten_signal_clock == 0) {
12072+
UPDATE_MISS_STATS(RESUME);
12073+
assert(_PyOpcode_Deopt[opcode] == (RESUME));
12074+
JUMP_TO_PREDICTED(RESUME);
12075+
}
12076+
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
12077+
#endif
12078+
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
12079+
uintptr_t version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version);
12080+
assert((version & _PY_EVAL_EVENTS_MASK) == 0);
12081+
if (eval_breaker != version) {
12082+
UPDATE_MISS_STATS(RESUME);
12083+
assert(_PyOpcode_Deopt[opcode] == (RESUME));
12084+
JUMP_TO_PREDICTED(RESUME);
12085+
}
12086+
#ifdef Py_GIL_DISABLED
12087+
if (frame->tlbc_index !=
12088+
((_PyThreadStateImpl *)tstate)->tlbc_index) {
12089+
UPDATE_MISS_STATS(RESUME);
12090+
assert(_PyOpcode_Deopt[opcode] == (RESUME));
12091+
JUMP_TO_PREDICTED(RESUME);
12092+
}
12093+
#endif
12094+
}
12095+
// _JIT
12096+
{
12097+
#ifdef _Py_TIER2
12098+
bool is_resume = this_instr->op.code == RESUME_CHECK_JIT;
12099+
_Py_BackoffCounter counter = this_instr[1].counter;
12100+
if ((backoff_counter_triggers(counter) &&
12101+
!IS_JIT_TRACING() &&
12102+
(this_instr->op.code == JUMP_BACKWARD_JIT || is_resume)) &&
12103+
next_instr->op.code != ENTER_EXECUTOR) {
12104+
_Py_CODEUNIT *insert_exec_at = this_instr;
12105+
while (oparg > 255) {
12106+
oparg >>= 8;
12107+
insert_exec_at--;
12108+
}
12109+
int succ = _PyJit_TryInitializeTracing(tstate, frame, this_instr, insert_exec_at,
12110+
is_resume ? insert_exec_at : next_instr, stack_pointer, 0, NULL, oparg, NULL);
12111+
if (succ) {
12112+
ENTER_TRACING();
12113+
}
12114+
else {
12115+
this_instr[1].counter = restart_backoff_counter(counter);
12116+
}
12117+
}
12118+
else {
12119+
ADVANCE_ADAPTIVE_COUNTER(this_instr[1].counter);
12120+
}
12121+
#endif
12122+
}
12123+
DISPATCH();
12124+
}
12125+
1203612126
TARGET(RETURN_GENERATOR) {
1203712127
#if _Py_TAIL_CALL_INTERP
1203812128
int opcode = RETURN_GENERATOR;

cinderx/Interpreter/3.15/cinderx_opcode_targets.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ static void *opcode_targets_table[256] = {
198198
&&TARGET_LOAD_SUPER_ATTR_ATTR,
199199
&&TARGET_LOAD_SUPER_ATTR_METHOD,
200200
&&TARGET_RESUME_CHECK,
201+
&&TARGET_RESUME_CHECK_JIT,
201202
&&TARGET_SEND_GEN,
202203
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
203204
&&TARGET_STORE_ATTR_SLOT,
@@ -232,7 +233,6 @@ static void *opcode_targets_table[256] = {
232233
&&_unknown_opcode,
233234
&&_unknown_opcode,
234235
&&_unknown_opcode,
235-
&&_unknown_opcode,
236236
&&TARGET_INSTRUMENTED_END_FOR,
237237
&&TARGET_INSTRUMENTED_POP_ITER,
238238
&&TARGET_INSTRUMENTED_END_SEND,
@@ -472,7 +472,7 @@ static void *opcode_tracing_targets_table[256] = {
472472
&&TARGET_TRACE_RECORD,
473473
&&TARGET_TRACE_RECORD,
474474
&&TARGET_TRACE_RECORD,
475-
&&_unknown_opcode,
475+
&&TARGET_TRACE_RECORD,
476476
&&_unknown_opcode,
477477
&&_unknown_opcode,
478478
&&_unknown_opcode,
@@ -719,6 +719,7 @@ static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RERAISE(TAIL_CALL_PARAMS);
719719
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RESERVED(TAIL_CALL_PARAMS);
720720
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RESUME(TAIL_CALL_PARAMS);
721721
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RESUME_CHECK(TAIL_CALL_PARAMS);
722+
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RESUME_CHECK_JIT(TAIL_CALL_PARAMS);
722723
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RETURN_GENERATOR(TAIL_CALL_PARAMS);
723724
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_RETURN_VALUE(TAIL_CALL_PARAMS);
724725
static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_SEND(TAIL_CALL_PARAMS);
@@ -961,6 +962,7 @@ static py_tail_call_funcptr instruction_funcptr_handler_table[256] = {
961962
[RESERVED] = _TAIL_CALL_RESERVED,
962963
[RESUME] = _TAIL_CALL_RESUME,
963964
[RESUME_CHECK] = _TAIL_CALL_RESUME_CHECK,
965+
[RESUME_CHECK_JIT] = _TAIL_CALL_RESUME_CHECK_JIT,
964966
[RETURN_GENERATOR] = _TAIL_CALL_RETURN_GENERATOR,
965967
[RETURN_VALUE] = _TAIL_CALL_RETURN_VALUE,
966968
[SEND] = _TAIL_CALL_SEND,
@@ -1008,7 +1010,6 @@ static py_tail_call_funcptr instruction_funcptr_handler_table[256] = {
10081010
[124] = _TAIL_CALL_UNKNOWN_OPCODE,
10091011
[125] = _TAIL_CALL_UNKNOWN_OPCODE,
10101012
[127] = _TAIL_CALL_UNKNOWN_OPCODE,
1011-
[213] = _TAIL_CALL_UNKNOWN_OPCODE,
10121013
[214] = _TAIL_CALL_UNKNOWN_OPCODE,
10131014
[215] = _TAIL_CALL_UNKNOWN_OPCODE,
10141015
[216] = _TAIL_CALL_UNKNOWN_OPCODE,
@@ -1219,6 +1220,7 @@ static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = {
12191220
[RESERVED] = _TAIL_CALL_TRACE_RECORD,
12201221
[RESUME] = _TAIL_CALL_TRACE_RECORD,
12211222
[RESUME_CHECK] = _TAIL_CALL_TRACE_RECORD,
1223+
[RESUME_CHECK_JIT] = _TAIL_CALL_TRACE_RECORD,
12221224
[RETURN_GENERATOR] = _TAIL_CALL_TRACE_RECORD,
12231225
[RETURN_VALUE] = _TAIL_CALL_TRACE_RECORD,
12241226
[SEND] = _TAIL_CALL_TRACE_RECORD,
@@ -1266,7 +1268,6 @@ static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = {
12661268
[124] = _TAIL_CALL_UNKNOWN_OPCODE,
12671269
[125] = _TAIL_CALL_UNKNOWN_OPCODE,
12681270
[127] = _TAIL_CALL_UNKNOWN_OPCODE,
1269-
[213] = _TAIL_CALL_UNKNOWN_OPCODE,
12701271
[214] = _TAIL_CALL_UNKNOWN_OPCODE,
12711272
[215] = _TAIL_CALL_UNKNOWN_OPCODE,
12721273
[216] = _TAIL_CALL_UNKNOWN_OPCODE,

cinderx/UpstreamBorrow/borrowed-3.15.gen_cached.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,8 +3293,7 @@ _PyExc_CreateExceptionGroup(const char *msg_str, PyObject *excs)
32933293
if (!msg) {
32943294
return NULL;
32953295
}
3296-
PyObject *args = PyTuple_Pack(2, msg, excs);
3297-
Py_DECREF(msg);
3296+
PyObject *args = _PyTuple_FromPairSteal(msg, Py_NewRef(excs));
32983297
if (!args) {
32993298
return NULL;
33003299
}

0 commit comments

Comments
 (0)