[Python-checkins] r57247 - sandbox/trunk/import_in_py/_importlib.py
brett.cannon
python-checkins at python.org
Tue Aug 21 07:03:38 CEST 2007
Author: brett.cannon
Date: Tue Aug 21 07:03:38 2007
New Revision: 57247
Modified:
sandbox/trunk/import_in_py/_importlib.py
Log:
Fix variable scoping issue in FileImporter.find_module.
Modified: sandbox/trunk/import_in_py/_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/_importlib.py (original)
+++ sandbox/trunk/import_in_py/_importlib.py Tue Aug 21 07:03:38 2007
@@ -550,6 +550,7 @@
def find_module(self, fullname, path=None):
tail_module = fullname.rsplit('.', 1)[-1]
+ package_directory = None
if self._possible_package:
for ext in self._suffixes:
package_directory = _path_join(self._path_entry, tail_module)
@@ -568,7 +569,8 @@
return self._loader(fullname, file_path, False)
else:
# Raise a warning if it matches a directory w/o an __init__ file.
- if (_path_isdir(package_directory) and
+ if (package_directory is not None and
+ _path_isdir(package_directory) and
_case_ok(self._path_entry, tail_module)):
warnings.warn("Not importing directory %s: missing __init__"
% package_directory,
More information about the Python-checkins
mailing list