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.
|
How much does this speedup the import of |
Sorry, something went wrong.
|
(Though it's probably worth doing even if it just speeds up the import of |
Sorry, something went wrong.
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
Sorry, something went wrong.
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>
edited by bedevere-app
Bot
LoadingUh oh!
There was an error while loading. Please reload this page.
Copy link Copy MarkdownSorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.