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
platform._sys_version does not parse correctly IronPython 2.x version #53210
Comments
Method _sys_version() module Lib\platform.py does parse correctly IronPython 2.x version The format of sys.version now start with a version number and ( File: Lib\platform.py |
Frederic Torres wrote:
I assume you meant: doesn't correctly parse the version number. Could you provide a complete example formatted as Python string, Thanks,Marc-Andre Lemburg 2010-07-19: EuroPython 2010, Birmingham, UK 38 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 |
print repr(sys_version) The format of sys.version now start with a version number |
Do you want to work on a patch? |
Eric, Yes I like to. It will affect IronPython 2.6 and IronPython 2.6 For .Net 4.0 and If you give me linsk to read about how to make a patch I would really Thanks. On Wed, Dec 22, 2010 at 4:02 AM, Éric Araujo <report@bugs.python.org> wrote:
|
This is the tracker for CPython, not IronPython, but I assume they synchronize their standard modules with ours, so I think this bug should be fixed here (not in 2.6 though, this old version only gets security fixes). Guidelines for patches: http://www.python.org/dev/patches/ In short: check out the py3k branch, add a test that fails in Lib/test/test_platform.py (in the test_sys_version method), then patch the code to make the test pass. |
I've checked sys.version on IronPython 2.6.1, 2.6.2 (same format) and 2.7.4 (slightly different). The patch includes two new test cases. I've also taken the liberty of adding some newlines in between the items in the dict as I found this code very hard to read otherwise. |
The patch looks good, except one nit: if 'IronPython' in sys_version is probably not supported in IronPython 2.0, since support for "n-char in m-char" tests were added after Python 2.1. Now, you can either leave this in and remove the IronPython 2.0 support from platform.py (which is fine, IMO), or change the test to use the .find() method. |
Hm, I see. Actually, "in" is already used in this function a little further down:
So we should change both occurrences then. I'm attaching a v2 with these changes. |
It seems the versions of IronPython 1.0 mentioned in test cases do actually support the "in" keyword, so the first version of the patch is probably sufficient. Example session: >>> sys.version
IronPython 1.0.60816 on .NET 2.0.50727.3643
>>> "IronPython" in sys.version
True
>>> sys.version.startswith("IronPython")
True |
On 19.10.2013 07:06, Martin Matusiak wrote:
>
> Martin Matusiak added the comment:
>
> It seems the versions of IronPython 1.0 mentioned in test cases do actually support the "in" keyword, so the first version of the patch is probably sufficient.
>
> Example session:
>
>>>> sys.version
> IronPython 1.0.60816 on .NET 2.0.50727.3643
>>>> "IronPython" in sys.version
> True
>>>> sys.version.startswith("IronPython")
> True In that case, I'm +1 on using both to clean up the code. |
Attaching a v3 which uses "in" and "startswith". Just for good measure I ran this module on IronPython 1.0 and it fails on import:
That's as far as I looked - there may be other issues still. So I decided to isolate this one function and see if it works. It fails because re.ASCII does not exist. If I remove that then the function runs and parses its own sys.version correctly. But it may be a bit of a stretch at this point to stay compatible that far back. |
On 19.10.2013 12:11, Martin Matusiak wrote:
Well, there's a catch here: the trunk version of platform.py is for Then there's the Python 2.7 version, which receives patches like yours. I think it's ok to use Python 2.4 as the latest version supported If IronPython 1.0 does not support Python 2.4, we don't need to |
Double checked that the test passes against both default and 2.7 branches. Is there anything else that needs to happen here or are you satisfied, Marc-Andre? |
On 19.10.2013 13:37, Martin Matusiak wrote:
No, that's all :-) Thanks, Martin. Unfortunately, I don't have time in the next few days to check this |
New changeset 04a163f93ad4 by Ezio Melotti in branch '2.7': New changeset 10a261824b62 by Ezio Melotti in branch '3.3': New changeset 1f7d8a42904c by Ezio Melotti in branch 'default': |
Fixed, thanks for the patch! |
On 21.10.2013 02:07, Ezio Melotti wrote:
Thanks, Ezio, for the check-in. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: