diff --git a/src/packaging/specifiers.py b/src/packaging/specifiers.py index 1f3adaf6..b30926af 100644 --- a/src/packaging/specifiers.py +++ b/src/packaging/specifiers.py @@ -234,7 +234,7 @@ def __init__(self, spec: str = "", prereleases: bool | None = None) -> None: """ match = self._regex.search(spec) if not match: - raise InvalidSpecifier(f"Invalid specifier: '{spec}'") + raise InvalidSpecifier(f"Invalid specifier: {spec!r}") self._spec: tuple[str, str] = ( match.group("operator").strip(), diff --git a/src/packaging/version.py b/src/packaging/version.py index edee1004..fc5573f7 100644 --- a/src/packaging/version.py +++ b/src/packaging/version.py @@ -199,7 +199,7 @@ def __init__(self, version: str) -> None: # Validate the version and parse it into pieces match = self._regex.search(version) if not match: - raise InvalidVersion(f"Invalid version: '{version}'") + raise InvalidVersion(f"Invalid version: {version!r}") # Store the parsed out pieces of the version self._version = _Version(