Conversation
Documentation build overview
|
|
This kind of changes is not worth documenting. Mutating a container while doing other things is not safe. The fix was just there to prevent crashes I believe. |
|
Fair, and the fix was for the crash rather than for this. I opened it because JelleZijlstra asked for the note on the issue, after the reporter said he hit it porting pydantic/monty to an alternate implementation rather than fuzzing:
If the call is not to document it, I will close this, and #156743 wants closing too rather than staying open with a Either way, one correction. The change landed in 3.14.6, not 3.14.7. The clinic default for stop is |
|
Mmj let me think about it a bit more. I can see why it can help but I do not consider that anything python impmementations should bother about (they can raise whatever they want). It is, IMO, a garbage-in/garbage out situation but let me think for a few days. |
deque.index()changed how it resolves start and stop when a bound's__index__method mutates the deque. The change is user visible and is notmentioned in the NEWS entry for gh-150750, which describes only the
free-threading race. gh-156743 reports it.
Before the change, Argument Clinic assigned stop its default of
Py_SIZE(deque)before_PyEval_SliceIndexNotNoneconverted start, so astart that mutated the deque during conversion left stop holding the old
length while start was resolved against the new one. stop now defaults to
PY_SSIZE_T_MAXanddeque_index_implreads the length once, after bothconverters have run, so the two bounds always agree.
Using the reproducer from the issue:
3.14.5 and earlier raise
ValueError. 3.14.6 and later return5, which isalso what
list.indexreturns for the equivalent list. The new behaviour takesa single length snapshot and is self-consistent, so it reads as intended and
only the documentation was missing.
This adds a
versionchangednote todeque.index. Documentation only, so noNEWS entry.
One correction to the issue
The issue reports the change as landing in 3.14.7. It landed in 3.14.6.
deque.indexanddequemutators onPy_SIZEwith free-threading #150750 is inMisc/NEWS.d/3.14.6.rst.Modules/_collectionsmodule.cis identical between thev3.14.6andv3.14.7tags apart from one unrelatedPy_DECREFremoval indeque_extend_impl.Py_SIZE(deque)atv3.14.5andPY_SSIZE_T_MAXatv3.14.6.5.The versions tested in the issue were 3.14.0, 3.14.2, 3.14.4 and 3.14.7, which
brackets the change but skips 3.14.6. The note therefore says 3.14.6.