Skip to content

Commit 0fcdb49

Browse files
committed
block top-level module namespaces not covered by stdlib-list
fixes #2940, initial work failed to take this into consideration.
1 parent 479c1f7 commit 0fcdb49

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

warehouse/forklift/legacy.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,19 @@
5252

5353
PATH_HASHER = "blake2_256"
5454

55+
56+
def namespace_stdlib_list(module_list):
57+
for module_name in module_list:
58+
parts = module_name.split('.')
59+
for i, part in enumerate(parts):
60+
yield '.'.join(parts[:i + 1])
61+
62+
5563
STDLIB_PROHIBITTED = {
5664
packaging.utils.canonicalize_name(s.rstrip('-_.').lstrip('-_.'))
57-
for s in chain.from_iterable(stdlib_list.stdlib_list(version)
58-
for version in stdlib_list.short_versions)
65+
for s in chain.from_iterable(
66+
namespace_stdlib_list(stdlib_list.stdlib_list(version))
67+
for version in stdlib_list.short_versions)
5968
}
6069

6170
# Wheel platform checking

0 commit comments

Comments
 (0)