Skip to content
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

version.parse : exception during version parsing #815

Closed
HarinadhD opened this issue Jul 4, 2024 · 3 comments
Closed

version.parse : exception during version parsing #815

HarinadhD opened this issue Jul 4, 2024 · 3 comments

Comments

@HarinadhD
Copy link

HarinadhD commented Jul 4, 2024

Below code snippet is working fine with the packaging version 21.3 , but throwing an error "Invalid version" on latest version (24.0 & 24.1)

test.py

import` os,sys,subprocess
from decimal import Decimal
from packaging import version
str1='8.9p1-8'
str2='8.9p1-6'
if version.parse(str1) > version.parse(str2):
    print("OK")

executing on version 24.0 & 24.1 :

#python3 test.py
Traceback (most recent call last):
  File "/root/test.py", line 9, in <module>
    if version.parse(str1) > version.parse(str2):
       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/packaging/version.py", line 56, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '8.9p1-8'

executing on version 21.3:

#python3 test.py
OK

@HarinadhD HarinadhD changed the title Exception during version parsing version.parse : exception during version parsing Jul 4, 2024
@HarinadhD
Copy link
Author

This behaviour is observed from version 22.0 and above , Is there any change in Version Specifiers Specifications ?

@pradyunsg
Copy link
Member

Please see #530 (which is also a pinned issue).

@pradyunsg pradyunsg closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
@HarinadhD
Copy link
Author

Got it , Thanks @pradyunsg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants