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-102491: Remove IronPython version check in sys_version#102492

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

Conversation

@eendebakpt
Copy link
Contributor

@eendebakpteendebakpt commentedMar 7, 2023
edited
Loading

The platform module contains various version checks for systems such as cpython and ironpython. The file also contains a specfic case for ironpython which can be removed (seeIronLanguages/ironpython3#1667)

Removing the check improves the import speed as it avoids the compilation of a two regular expressions.

%timeit _ironpython26_sys_version_parser = re.compile(r'([\d.]+)\s*'   r'\(IronPython\s*'    r'[\d.]+\s*'    r'\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)' )383 ns ± 1.66 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)

Note: most of the compiled regular expressions inplatform.py can be moved into the methods using them, as most results are cached. This would reduce the importtime forplatform even further:

Main: The speed of "import platform" is: 8.231517 +- 0.499458 [ms]Regular expressions adapted: The speed of "import platform" is: 7.182120 +- 0.726896 [ms]

Copy link
Contributor

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good. Would you mind adding the news entry?

Copy link
Contributor

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

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

Hm, not an issue with this PR, but I was curious what IronPython is doing. It looks like their platform.py hashttps://github.com/IronLanguages/ironpython3/blob/f41afc44534786721b89e1efb8e50c4232ee1224/Src/StdLib/Lib/platform.py#L1141 andhttps://github.com/IronLanguages/ironpython3/blob/f41afc44534786721b89e1efb8e50c4232ee1224/Src/StdLib/Lib/platform.py#L1187

Weirdly, IronPython'sdocs indicates that its sys.version would not match the regex we have or the regex they have in their platform.py.

@eendebakpt
Copy link
ContributorAuthor

Hm, not an issue with this PR, but I was curious what IronPython is doing. It looks like their platform.py hashttps://github.com/IronLanguages/ironpython3/blob/f41afc44534786721b89e1efb8e50c4232ee1224/Src/StdLib/Lib/platform.py#L1141 andhttps://github.com/IronLanguages/ironpython3/blob/f41afc44534786721b89e1efb8e50c4232ee1224/Src/StdLib/Lib/platform.py#L1187

Weirdly, IronPython'sdocs indicates that its sys.version would not match the regex we have or the regex they have in their platform.py.

@hauntsaninja Good point. I created an issueIronLanguages/ironpython3#1667. Based on the decision there, can you (as core dev) make a decision on the other ironpython regular expression.

@eendebakpteendebakpt changed the titlegh-102491: remove ironpython python 2.x version checkgh-102491: Remove IronPython version check in sys_versionMar 12, 2023
Copy link
Contributor

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

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

Thank you!

@hauntsaninjahauntsaninja merged commit382ee2f intopython:mainMar 19, 2023
Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this pull requestMar 27, 2023
@eendebakpteendebakpt deleted the remove_ironpython_python2 branchJune 26, 2025 13:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hauntsaninjahauntsaninjahauntsaninja approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@eendebakpt@hauntsaninja@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp