-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Description
Bug report
When building an untagged version of CPython, the resulting version ends with a plus sign, e.g. 3.11.0+
. This version doesn't comply with PEP 440. As mentioned in #88166 (comment) PEP 440 does only apply to Python packages but not to CPython itself. However, a CPython version that doesn't comply with PEP 440 leads to unwanted side effects considering the python_full_version
environment marker from PEP 508.
According to PEP 508 python_full_version
is equal to platform.python_version()
which is 3.11.0+
in my example.
Further, PEP 508 says:
The <version_cmp> operators use the PEP 440 version comparison rules when those are defined (that is when both sides have a valid version specifier). If there is no defined PEP 440 behaviour and the operator exists in Python, then the operator falls back to the Python behaviour.
That means an environment marker like python_full_version >= "3.9.0"
is fulfilled for Python 3.11.0 because a PEP 440 version comparison is performed. However, it is not fulfilled for Python 3.11.0+ because 3.11.0+ is not a valid version and thus a string comparison is performed.
This has also practical implications. When trying to pip install a requirement with such a marker, pip says markers 'python_full_version >= "3.9.0"' don't match your environment
. And if I understand correctly, it's right about that. However, that can't be intentional, can it? Wouldn't it be better to make sure that CPython versions always comply with PEP 440?
Your environment
- CPython versions tested on: 3.11.0+ from https://github.com/deadsnakes/nightly but any version ending with "+" will do
- Operating system and architecture: Ubuntu 20.04 x64 (should be irrelevant)