Files
codeql/python/ql/test/library-tests
yoff cd703dcf0c Python: omit PEP 695 type-param names from FunctionDefExpr/ClassDefExpr children
PEP 695 type-param names (e.g. `T` in `def func[T]:` or `class Box[T]:`)
bind in an annotation scope that nests the function/class body, so
their AST scope is the inner function/class — not the enclosing scope
where the FunctionDefExpr/ClassDefExpr CFG node lives. Visiting them
as children created scope-crossing CFG edges (nonLocalStep violations:
96 across CPython).

Drop them from the children list; the legacy CFG omitted them too.
TypeAliasStmt is unaffected (its type-params share scope with the
alias's enclosing scope).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-26 17:09:09 +00:00
..
2025-11-26 12:30:31 +00:00
2025-11-26 12:30:31 +00:00
2026-04-14 13:27:31 +02:00
2020-03-30 11:59:10 +02:00
2025-11-26 12:30:31 +00:00
2025-11-26 12:30:31 +00:00
2022-08-24 16:51:50 +01:00
2025-11-26 12:30:31 +00:00
2025-11-26 12:30:31 +00:00
2025-11-26 12:30:31 +00:00
2023-11-06 13:50:55 +00:00
2020-03-30 11:59:10 +02:00
2025-11-26 12:30:31 +00:00
2025-11-26 12:30:31 +00:00
2023-04-26 13:41:57 +02:00