Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ._tokenizer import ParserSyntaxError
from .specifiers import InvalidSpecifier, Specifier
from .utils import canonicalize_name
from .version import InvalidVersion

__all__ = [
"InvalidMarker",
Expand Down Expand Up @@ -180,7 +181,10 @@ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
except InvalidSpecifier:
pass
else:
return spec.contains(lhs, prereleases=True)
try:
return spec.contains(lhs, prereleases=True)
except InvalidVersion:
pass

oper: Operator | None = _operators.get(op.serialize())
if oper is None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def test_environment_with_extra_none(self):
{"os_name": "other", "python_version": "2.7.4"},
False,
),
("platform_release >= '6'", {"platform_release": "6.1-foobar"}, True),
("extra == 'security'", {"extra": "quux"}, False),
("extra == 'security'", {"extra": "security"}, True),
("extra == 'SECURITY'", {"extra": "security"}, True),
Expand Down
Loading