Uh oh!
There was an error while loading. Please reload this page.
gh-117865: Defer import of re in ast - #119546
Conversation
This is used only by ast.get_source_segment(), so it seems sensible to avoid importing it.
AlexWaygood
commented
May 25, 2024
How much does this speedup the import of |
AlexWaygood
commented
May 25, 2024
(Though it's probably worth doing even if it just speeds up the import of |
AlexWaygood
left a comment
There was a problem hiding this comment.
Locally for me this cuts about 20% off the import time for ast (0.0036s -> 0.0029s), so this seems worth doing. This is especially true since the _splitlines_no_ff function is only ever used in get_source_segment, which is one of the lesser-used ast-module APIs
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This is used only by ast.get_source_segment(), so it seems sensible to avoid importing it. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Uh oh!
There was an error while loading. Please reload this page.