Skip to content

Commit

Permalink
Handles name == None case (re: issue python-poetry#4311)
Browse files Browse the repository at this point in the history
Addresses issue python-poetry#4311 and others, related to `canonicalize_name` throwing TypeError because a str or bytes like object was expected.
  • Loading branch information
aalok-sathe authored Nov 2, 2021
1 parent 5dcf24d commit 4344402
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions poetry/repositories/installed_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,13 @@ def load(cls, env: Env, with_dependencies: bool = False) -> "InstalledRepository
metadata.distributions(path=[entry]),
key=lambda d: str(d._path),
):
name = canonicalize_name(distribution.metadata["name"])

try:
name = canonicalize_name(distribution.metadata["name"])
except TypeError as e:
# handling the case where a distribution is empty but is nevertheless picked up in the search
# and its name is `None`
continue

if name in seen:
continue

Expand Down

0 comments on commit 4344402

Please sign in to comment.