From 4fbe61af3a77fef5594329d41355571cf1adf94f Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Sat, 23 May 2020 10:04:20 +0530 Subject: [PATCH] Update message type to configparser.Error --- src/pip/_internal/exceptions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pip/_internal/exceptions.py b/src/pip/_internal/exceptions.py index c92b8cecd..f478a2b49 100644 --- a/src/pip/_internal/exceptions.py +++ b/src/pip/_internal/exceptions.py @@ -11,6 +11,7 @@ from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Optional, List, Dict from pip._vendor.pkg_resources import Distribution + from pip._vendor.six.moves import configparser from pip._internal.req.req_install import InstallRequirement from pip._vendor.six import PY3 if PY3: @@ -312,7 +313,7 @@ class ConfigurationFileCouldNotBeLoaded(ConfigurationError): """ def __init__(self, reason="could not be loaded", fname=None, error=None): - # type: (str, Optional[str], Optional[Exception]) -> None + # type: (str, Optional[str], Optional[configparser.Error]) -> None super(ConfigurationFileCouldNotBeLoaded, self).__init__(error) self.reason = reason self.fname = fname @@ -324,6 +325,5 @@ class ConfigurationFileCouldNotBeLoaded(ConfigurationError): message_part = " in {}.".format(self.fname) else: assert self.error is not None - # message attribute for Exception is only available for Python 2 - message_part = ".\n{}\n".format(self.error.message) # type: ignore + message_part = ".\n{}\n".format(self.error) return "Configuration file {}{}".format(self.reason, message_part)