From: Brett Cannon Date: Tue, 17 Apr 2012 03:11:28 +0000 (-0400) Subject: Properly guard against special-casing. X-Git-Tag: v3.3.0a3~182 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=578393b2862173d54baa32684812617b2e995412;p=python Properly guard against special-casing. --- diff --git a/Lib/imp.py b/Lib/imp.py index 0b344d6007..dc685d0e11 100644 --- a/Lib/imp.py +++ b/Lib/imp.py @@ -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