8000 gh-102491: Remove IronPython version check in sys_version by eendebakpt · Pull Request #102492 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove IronPython version checks
  • Loading branch information
eendebakpt committed Mar 12, 2023
commit 7ffe733302b96f4f61d95eb794205730be1e6e76
24 changes: 1 addition & 23 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,12 +1040,6 @@ def processor():
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"

_ironpython_sys_version_parser = re.compile(
r'IronPython\s*'
r'([\d\.]+)'
r'(?: \(([\d\.]+)\))?'
r' on (.NET [\d\.]+)', re.ASCII)

_pypy_sys_version_parser = re.compile(
r'([\w.+]+)\s*'
r'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
Expand Down Expand Up @@ -1082,22 +1076,7 @@ def _sys_version(sys_version=None):
if result is not None:
return result

# Parse it
if 'IronPython' in sys_version:
# IronPython
name = 'IronPython'
match = _ironpython_sys_version_parser.match(sys_version)

if match is None:
raise ValueError(
'failed to parse IronPython sys.version: %s' %
repr(sys_version))

version, alt_version, compiler = match.groups()
buildno = ''
builddate = ''

elif sys.platform.startswith('java'):
if sys.platform.startswith('java'):
# Jython
name = 'Jython'
match = _sys_version_parser.match(sys_version)
Expand Down Expand Up @@ -1160,7 +1139,6 @@ def python_implementation():

Currently, the following implementations are identified:
'CPython' (C implementation of Python),
'IronPython' (.NET implementation of Python),
'Jython' (Java implementation of Python),
'PyPy' (Python implementation of Python).

Expand Down
9 changes: 0 additions & 9 deletions Lib/test/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ def test_sys_version(self):
for input, output in (
('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
('IronPython 1.0.60816 on .NET 2.0.50727.42',
('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
('2.4.3 (truncation, date, t) \n[GCC]',
('CPython', '2.4.3', '', '', 'truncation', 'date t', 'GCC')),
('2.4.3 (truncation, date, ) \n[GCC]',
Expand Down Expand Up @@ -167,11 +163,6 @@ def test_sys_version(self):
('CPython', '3.10.8', '', '',
('tags/v3.10.8:aaaf517424', 'Feb 14 2023 16:28:12'), 'GCC 9.4.0'),

("IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053", None, "cli")
:
("IronPython", "2.0.0", "", "", ("", ""),
".NET 2.0.50727.3053"),

("2.5 (trunk:6107, Mar 26 2009, 13:02:18) \n[Java HotSpot(TM) Client VM (\"Apple Computer, Inc.\")]",
('Jython', 'trunk', '6107'), "java1.5.0_16")
:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Improve import time of ``platform`` be removing a legacy ironpython 2.x version check.
Improve import time of ``platform`` by removing IronPython version parsing. The IronPython version parsing
was not functional (see https://github.com/IronLanguages/ironpython3/issues/1667).
0