@@ -309,17 +309,23 @@ def evaluate(self, environment: dict[str, str] | None = None) -> bool:
309
309
"""
310
310
current_environment = cast ("dict[str, str]" , default_environment ())
311
311
current_environment ["extra" ] = ""
312
- # Work around platform.python_version() returning something that is not PEP 440
313
- # compliant for non-tagged Python builds. We preserve default_environment()'s
314
- # behavior of returning platform.python_version() verbatim, and leave it to the
315
- # caller to provide a syntactically valid version if they want to override it.
316
- if current_environment ["python_full_version" ].endswith ("+" ):
317
- current_environment ["python_full_version" ] += "local"
318
312
if environment is not None :
319
313
current_environment .update (environment )
320
314
# The API used to allow setting extra to None. We need to handle this
321
315
# case for backwards compatibility.
322
316
if current_environment ["extra" ] is None :
323
317
current_environment ["extra" ] = ""
324
318
325
- return _evaluate_markers (self ._markers , current_environment )
319
+ return _evaluate_markers (
320
+ self ._markers , _repair_python_full_version (current_environment )
321
+ )
322
+
323
+
324
+ def _repair_python_full_version (env : dict [str , str ]) -> dict [str , str ]:
325
+ """
326
+ Work around platform.python_version() returning something that is not PEP 440
327
+ compliant for non-tagged Python builds.
328
+ """
329
+ if env ["python_full_version" ].endswith ("+" ):
330
+ env ["python_full_version" ] += "local"
331
+ return env
0 commit comments