From 0fcd11fb91e6c086c1e3e96d2e214c8cb9006dc0 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sun, 9 Apr 2023 10:16:04 -0500 Subject: [PATCH] Use `parse_version` as the name for `packaging.version.parse` --- src/pip/_internal/utils/deprecation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/utils/deprecation.py b/src/pip/_internal/utils/deprecation.py index 72bd6f25a55..6ae160ca694 100644 --- a/src/pip/_internal/utils/deprecation.py +++ b/src/pip/_internal/utils/deprecation.py @@ -6,7 +6,7 @@ import warnings from typing import Any, Optional, TextIO, Type, Union -from pip._vendor.packaging.version import parse +from pip._vendor.packaging.version import parse as parse_version from pip import __version__ as current_version # NOTE: tests patch this name. @@ -81,7 +81,10 @@ def deprecated( """ # Determine whether or not the feature is already gone in this version. - is_gone = gone_in is not None and parse(current_version) >= parse(gone_in) + if gone_in is None: + is_gone = False + else: + is_gone = parse_version(current_version) >= parse_version(gone_in) message_parts = [ (reason, f"{DEPRECATION_MSG_PREFIX}{{}}"),