Skip to content

Commit

Permalink
Ensure Path.glob argument is a string
Browse files Browse the repository at this point in the history
When excluded path is not a glob pattern, pathlib implementation relies
on `sys.intern`, which expects a string. However, the value passed in
is of `tomlkit.items.String`. This change ensures poetry does not
crash in this scenario.

Resolves: python-poetry/poetry#2798

Co-authored-by: David Lee <[email protected]>
  • Loading branch information
2 people authored and finswimmer committed Aug 15, 2020
1 parent faefb7d commit 9a05290
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry/core/masonry/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def find_excluded_files(self): # type: () -> Set[str]

explicitely_excluded = set()
for excluded_glob in self._package.exclude:
for excluded in self._path.glob(excluded_glob):
for excluded in self._path.glob(str(excluded_glob)):
explicitely_excluded.add(
Path(excluded).relative_to(self._path).as_posix()
)
Expand Down
1 change: 1 addition & 0 deletions tests/masonry/builders/fixtures/complete/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
]

exclude = [
"does-not-exist",
"**/*.xml"
]

Expand Down

0 comments on commit 9a05290

Please sign in to comment.