Skip to content

Commit 6e75552

Browse files
author
Sebastian Ramacher
committed
Use imp to get the suffix that should be dropped (Closes: #204).
Don't just drop the extension since Python 3 supports modules named like foo.cpython-XY.so. Use the suffixes from imp.get_suffixes() instead.
1 parent 28521a4 commit 6e75552

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bpython/importcompletion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def find_modules(path):
123123
# Unfortunately, CPython just crashes if there is a directory
124124
# which ends with a python extension, so work around.
125125
continue
126-
name = os.path.splitext(name)[0]
126+
for suffix in imp.get_suffixes():
127+
if name.endswith(suffix[0]):
128+
name = name[:-len(suffix[0])]
129+
break
127130
if py3 and name == "badsyntax_pep3120":
128131
# Workaround for issue #166
129132
continue

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy