mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Fix SF bug #116263: support for from .. import *
transformer.py: return '*', None from com_import_as_name pycodegen.py: special case for name == '*' pyassem.py: fix stack counting for IMPORT_ opcodes
This commit is contained in:
parent
babe326c65
commit
4e1be72e6b
6 changed files with 26 additions and 8 deletions
|
@ -439,9 +439,14 @@ class CodeGenerator:
|
|||
for name, alias in node.names:
|
||||
if name == '*':
|
||||
self.namespace = 0
|
||||
self.emit('IMPORT_FROM', name)
|
||||
self._resolveDots(name)
|
||||
self.storeName(alias or name)
|
||||
self.emit('IMPORT_STAR')
|
||||
# There can only be one name w/ from ... import *
|
||||
assert len(node.names) == 1
|
||||
return
|
||||
else:
|
||||
self.emit('IMPORT_FROM', name)
|
||||
self._resolveDots(name)
|
||||
self.storeName(alias or name)
|
||||
self.emit('POP_TOP')
|
||||
|
||||
def _resolveDots(self, name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue