summaryrefslogtreecommitdiff
path: root/pyximport
diff options
context:
space:
mode:
authorPrakhar Goel <prakhar.goel@beacon.io>2018-05-24 16:31:33 -0400
committerPrakhar Goel <prakhar.goel@beacon.io>2018-05-24 16:31:33 -0400
commit65fb9d7968cf0c49d5ebd7327c9f7e03a51cdee2 (patch)
tree4223b09c1affec9437e35457f01955c4876a1e97 /pyximport
parent8cab7b0af130cba0e101ced858402d9d793b7ccc (diff)
downloadcython-65fb9d7968cf0c49d5ebd7327c9f7e03a51cdee2.tar.gz
Fix importing of namespace packages. Add in a regtest for the same.
Diffstat (limited to 'pyximport')
-rw-r--r--pyximport/pyximport.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py
index 73961ed0e..5628f301b 100644
--- a/pyximport/pyximport.py
+++ b/pyximport/pyximport.py
@@ -249,6 +249,10 @@ class PyxImporter(object):
def find_module(self, fullname, package_path=None):
if fullname in sys.modules and not pyxargs.reload_support:
return None # only here when reload()
+
+ # package_path might be a _NamespacePath. Convert that into a list...
+ if package_path is not None and not isinstance(package_path, list):
+ package_path = list(package_path)
try:
fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)
if fp: fp.close() # Python should offer a Default-Loader to avoid this double find/open!