You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep trivial instances and aliases during expansion (#19543)
This weirdly looking change consistently shows 1% performance
improvement on my machine (Python 3.12, compiled). The key here is to
_not_ create new objects for trivial instances and aliases (i.e. those
with no `.args`). The problem however is that some callers modify
expanded type aliases _in place_ (for better error locations). I updated
couple places discovered by tests, but there may be more.
I think we should go ahead, and then fix bugs exposed by this using
following strategy:
* Always use original aliases (not theirs expansions) as error locations
(see change in `semanal.py`).
* If above is not possible (see unpacked tuple change), then call
`t.copy_modified()` followed by `t.set_line()` manually.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
0 commit comments