]> granicus.if.org Git - python/commitdiff
Jacob Hallen cornered me here at EuroPython and got me to look at
authorMichael W. Hudson <mwh@python.net>
Fri, 27 Jun 2003 12:32:39 +0000 (12:32 +0000)
committerMichael W. Hudson <mwh@python.net>
Fri, 27 Jun 2003 12:32:39 +0000 (12:32 +0000)
patch:

[ 750008 ] 'compiler' module bug with 'import foo.bar as baz'

which I'm now checking in.

after import foo.bar as baz, baz would refer to foo.

Lib/compiler/pycodegen.py

index a6face0a796f4c23392ab90dacb16825bc4b7716..009afbd09d06795a7c1a47dff977787b16e98628 100644 (file)
@@ -761,7 +761,11 @@ class CodeGenerator:
                 self.emit('LOAD_CONST', None)
             self.emit('IMPORT_NAME', name)
             mod = name.split(".")[0]
-            self.storeName(alias or mod)
+            if alias:
+                self._resolveDots(name)
+                self.storeName(alias)
+            else:
+                self.storeName(mod)
 
     def visitFrom(self, node):
         self.set_lineno(node)