mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140141: Properly break exception chain in importlib.metadata.Distribution.from_name (#140142)
This commit is contained in:
parent
f673f0e7b4
commit
bcced02604
2 changed files with 6 additions and 1 deletions
|
|
@ -457,7 +457,7 @@ def from_name(cls, name: str) -> Distribution:
|
|||
try:
|
||||
return next(iter(cls._prefer_valid(cls.discover(name=name))))
|
||||
except StopIteration:
|
||||
raise PackageNotFoundError(name)
|
||||
raise PackageNotFoundError(name) from None
|
||||
|
||||
@classmethod
|
||||
def discover(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue