Skip to content

v2.9.0 — Toponymy

Latest

Choose a tag to compare

@Technologicat Technologicat released this 06 Oct 14:29
· 8 commits to master since this release

Changed

  • A file Python would not compile is now left out with a warning, instead of aborting the whole run.
    • The warning names the file and line, and the rest of the files are analyzed as usual.
    • Besides syntax errors, this covers scoping errors such as a nonlocal after an assignment, which code using syntactic macros can contain before expansion.
    • --module-level skips only what does not parse, since it does not check scopes.

Fixed

  • Calls and names inside an assignment target are now recorded as uses.

    • In table[slot()] = 1 and make().attr = 2, the calls to slot and make were missing from the graph, as was the read of table.
  • Lambdas and comprehensions are now always analyzed in their own scopes (#142).

    • Wherever pyan met two lambdas in a different order than Python does, they could trade scopes. A nested lambda then aborted the run with ValueError: Unknown scope, as in the reported x.do(lambda: ...).do(lambda a: a.do(lambda: ...)).
    • Affected: method chains, assignments with a lambda on both sides of the =, a lambda among a function's defaults and another in its decorator, a lambda default of a lambda, and lambdas in annotations and class bases.
    • Without a nested lambda nothing crashed, but on Python 3.12+ a lambda following a comprehension that held one could share that lambda's scope, and pick up its parameters.