Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-117865: Defer import of re in ast#119546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 2 commits intopython:mainfromJelleZijlstra:ast-re
May 28, 2024

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commentedMay 25, 2024
edited by bedevere-appbot
Loading

This is used only by ast.get_source_segment(), so it seems sensible to avoid importing it.
@AlexWaygood
Copy link
Member

How much does this speedup the import ofinspect? I wouldn't expect it to do much on its own, sinceinspect itself also importsre. Or is the idea that this could be done in combination with some of the changes in#119526?

@AlexWaygood
Copy link
Member

(Though it's probably worth doing even if it just speeds up the import ofast. I guess I was looking at it through the lens of the github issue it was attached to.)

Copy link
Member

@AlexWaygoodAlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Locally for me this cuts about 20% off the import time forast (0.0036s -> 0.0029s), so this seems worth doing. This is especially true since the_splitlines_no_ff function is only ever used inget_source_segment, which is one of the lesser-usedast-module APIs

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@JelleZijlstraJelleZijlstra merged commitae11d68 intopython:mainMay 28, 2024
33 checks passed
@JelleZijlstraJelleZijlstra deleted the ast-re branchMay 28, 2024 18:04
estyxx pushed a commit to estyxx/cpython that referenced this pull requestJul 17, 2024
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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

@isidenticalisidenticalAwaiting requested review from isidenticalisidentical is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@JelleZijlstra@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp