Skip to content

Batch pmp17: feat/tp-s2 up to d47d66ed - #553

Merged
b-re-w merged 7 commits into
developfrom
feat/ci-batch-pmp17
Nov 27, 2026
Merged

b-re-w merged 7 commits into
developfrom
feat/ci-batch-pmp17

Conversation

@b-re-w

@b-re-w b-re-w commented Nov 27, 2026

Copy link
Copy Markdown
Member

CI run 45945970396 (ci.yml) at f70add3: every job green except the recorded WasmCompiledWheelTest (599 run, 1 failed; wasmJsBrowserTest 10), which waits for pypackpack #82's cp315t wasm wheel (Decision 10 c1). This lands feat/tp-s2 up to d47d66e (S2c: reversed, enumerate, zip and the earlier S2 commits, part of #443). Bench compile-set diff develop d2df489 vs d47d66e: EQUAL.

A parameter or result annotated KeysView[K], ValuesView[V] or ItemsView[K, V]
(from collections.abc import ..., the one `from` import of an AOT program, for
annotations only) holds the view's dict, as a view name does. A KeysView
compares only the keys of its dict and a ValuesView only the values
(ir.view_match), so a KeysView[str] takes the keys of any dict[str, V]. A call
returning a view is used as a view (loop, len, in, truth, repr, binding, passing
on); a method returning a view and a view at the library boundary are refused.
Agent proposal, not confirmed.
#443)

typedpython/comprehensions.py rewrites a comprehension that is the whole value
of an assignment to a name or of a return into the loop it means, before the
tuples are split: a hidden local per variable (Python 3 scoping), typed by
Pyrefly at a probe placed before the statement in the typed copy; a hidden
accumulator typed as the target, so the target is bound once the comprehension
is complete; CPython's order of evaluation (a dict comprehension's key before
its value). Elsewhere a comprehension is refused as "bind it to a name first";
aot-check reports only those as pending. Agent proposal, not confirmed.
A method annotated -> KeysView[K] (ValuesView, ItemsView) compiles: obj.m() on a local of
the class is a view call as a module function's is (a local, a for loop, len, in, truth,
print, passed to a view parameter, returned as a view); any other use is refused naming
the view.
…on clause (#443)

for i, x in enumerate(it, start) is the loop over it with a hidden counter bound to i
before the body; for a, b in zip(xs, ys) reads names of lists or strs by index while the
index is below every length (typedpython/loops.py). zip's names are typed as the elements
of the operands Pyrefly types in the for header; a dict or set operand, strict=, a single
target name and enumerate or zip anywhere else are refused.
for x in reversed(xs), also inside enumerate() and in a comprehension clause, reads the
list or str by index from its end, the index checked against the length at every step as
CPython's reversed list iterator checks it (typedpython/loops.py).
r = range(a, b, STEP) with an int constant step is held as its start and stop in hidden
int locals and its length computed once per binding (typedpython/ranges.py); a for loop
over it, len(), in, its truth and its repr are rewritten into what CPython computes. A
non-constant or zero step, a name bound to a range and to anything else, and any other
use are refused.
@b-re-w
b-re-w merged commit 298e2a6 into develop Nov 27, 2026
23 of 24 checks passed
@b-re-w
b-re-w deleted the feat/ci-batch-pmp17 branch November 27, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant