summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2020-10-19 21:14:21 (GMT)
committerGitHub <noreply@github.com>2020-10-19 21:14:21 (GMT)
commit96ddc58281d2b6b2258b1a628bccf252090d5611 (patch)
tree7147b420c790abefc96072a9ec311ffe9cddc509 /Lib/importlib
parent95ad890a7b0341d8d2fde13f824bc24c65a8ece0 (diff)
downloadcpython-96ddc58281d2b6b2258b1a628bccf252090d5611.zip
cpython-96ddc58281d2b6b2258b1a628bccf252090d5611.tar.gz
cpython-96ddc58281d2b6b2258b1a628bccf252090d5611.tar.bz2
bpo-42089: Sync with current cpython branch of importlib_metadata (GH-22775)
~~The only differences are in the test files.~~ Automerge-Triggered-By: @jaraco
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/metadata.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py
index ffa0cba..302d61d 100644
--- a/Lib/importlib/metadata.py
+++ b/Lib/importlib/metadata.py
@@ -37,6 +37,15 @@ __all__ = [
class PackageNotFoundError(ModuleNotFoundError):
"""The package was not found."""
+ def __str__(self):
+ tmpl = "No package metadata was found for {self.name}"
+ return tmpl.format(**locals())
+
+ @property
+ def name(self):
+ name, = self.args
+ return name
+
class EntryPoint(
collections.namedtuple('EntryPointBase', 'name value group')):