Repository navigation
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
nonlocalafter an assignment, which code using syntactic macros can contain before expansion. --module-levelskips 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()] = 1andmake().attr = 2, the calls toslotandmakewere missing from the graph, as was the read oftable.
- In
-
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 reportedx.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.
- Wherever pyan met two lambdas in a different order than Python does, they could trade scopes. A nested lambda then aborted the run with