diff --git a/src/packaging/markers.py b/src/packaging/markers.py index 72ff5ead..6201f8d3 100644 --- a/src/packaging/markers.py +++ b/src/packaging/markers.py @@ -309,7 +309,6 @@ def evaluate(self, environment: dict[str, str] | None = None) -> bool: """ current_environment = cast("dict[str, str]", default_environment()) current_environment["extra"] = "" - _repair_python_full_version(current_environment) if environment is not None: current_environment.update(environment) # The API used to allow setting extra to None. We need to handle this @@ -317,15 +316,15 @@ def evaluate(self, environment: dict[str, str] | None = None) -> bool: if current_environment["extra"] is None: current_environment["extra"] = "" - return _evaluate_markers(self._markers, current_environment) + return _evaluate_markers( + self._markers, _repair_python_full_version(current_environment) + ) def _repair_python_full_version(env): """ Work around platform.python_version() returning something that is not PEP 440 - compliant for non-tagged Python builds. Preserve default_environment()'s - behavior of returning platform.python_version() verbatim, and leave it to the - caller to provide a syntactically valid version if they want to override it. + compliant for non-tagged Python builds. """ if env["python_full_version"].endswith("+"): env["python_full_version"] += "local"