]> granicus.if.org Git - python/commitdiff
Properly guard against special-casing.
authorBrett Cannon <brett@python.org>
Tue, 17 Apr 2012 03:11:28 +0000 (23:11 -0400)
committerBrett Cannon <brett@python.org>
Tue, 17 Apr 2012 03:11:28 +0000 (23:11 -0400)
Lib/imp.py

index 0b344d600789b47bc692274485e309162127c056..dc685d0e11b204657435e5e84794affd5314329d 100644 (file)
@@ -36,7 +36,7 @@ class _LoadSourceCompatibility(_bootstrap._SourceFileLoader):
     def get_data(self, path):
         """Gross hack to contort SourceFileLoader to deal w/ load_source()'s bad
         API."""
-        if path == self._path:
+        if self.file and path == self._path:
             with self.file:
                 # Technically should be returning bytes, but
                 # SourceLoader.get_code() just passed what is returned to