Skip to content

Commit

Permalink
Update message type to configparser.Error
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshks committed May 23, 2020
1 parent 71c0fb0 commit 4fbe61a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pip/_internal/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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:
Expand Down Expand Up @@ -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
Expand All @@ -324,6 +325,5 @@ def __str__(self):
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)

0 comments on commit 4fbe61a

Please sign in to comment.