Error when scanning for modules with a different Python 3 version
Digging in to debugging it, I can reproduce it, and I find that, on Python 3.3, it's trying to load
scipy.lib.lapack.flapack.cpython-32mu. That comes about because the filename
flapack.cpython-32mu.so is an extension module (
scipy.lib.lapack.flapack) for Python 3.2, but
.so alone is also valid as a suffix.
_InternalImportModule checks first in a cache (
_modules), which includes modules it has looked for and failed to find (represented as a
None value). However, if it finds a None value in the cache, it doesn't set the error part of the return value, so the caller tries to use the None as a module.
The attached patch is a quick fix for this, but we should consider better ways to approach it. E.g. we could do away with the separate
returnError field, and just check
if module is None for a failure to find the module.