Repository navigation
bpo-29917: DOC: Remove link from PyMethodDef (#890) - #895
Merged
Merged
Conversation
parawanderer
added a commit
to parawanderer/cpython
that referenced
this pull request
Oct 20, 2026
window-ml PYTHON_DIALECT.md python#895, replacing 2026-10-15's "restriction is a property of the entry": a CO_RESTRICTED frame entered while no run is active (not restricted, not lifted) raises NotInDialect, so a function a cell defined runs nowhere the gate does not. The check is a tier-1 op at RESUME (_RESTRICTED_ENTRY, in RESUME and INSTRUMENTED_RESUME), which every route into such code passes: a call, a C library calling it back from host code, exec() of its code, and a generator's or coroutine's resumption. RESUME_CHECK deopts on CO_RESTRICTED code and _QUICKEN_RESUME leaves it unquickened, so a specializing build takes the same check. The text names the function as the cell wrote it and says what to do: "f() was defined in a cell that ran inside the read-only dialect, unasked, and runs only there; define it again in this cell to call it here". Tests (OutsideRunTest): each route, a nested function, the name without the wrapper's "_user.<locals>.", and host code untouched; two tests that pinned the old rule now assert the refusal. Mutation: without the op in RESUME, 9 of 145 fail. Cost, native arm64 build, 9 interleaved runs, median of best-of-5: 2M calls 95.7 -> 97.0 ms (+0.6 ns/call, x1.013); 2M generator resumptions 64.1 -> 63.2 ms (x0.986). Both within the runs' spread (90-98 and 95-100 ms; 63-67 and 62-65 ms). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(cherry picked from commit c3c7ef0)