mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix compiler breakage related to absolute imports
This commit is contained in:
parent
9742f27a9a
commit
d4e3035701
1 changed files with 2 additions and 2 deletions
|
@ -891,7 +891,7 @@ class CodeGenerator:
|
|||
|
||||
def visitImport(self, node):
|
||||
self.set_lineno(node)
|
||||
level = 0 if "absolute_import" in self.futures else -1
|
||||
level = 0 if self.graph.checkFlag(CO_FUTURE_ABSIMPORT) else -1
|
||||
for name, alias in node.names:
|
||||
if VERSION > 1:
|
||||
self.emit('LOAD_CONST', level)
|
||||
|
@ -907,7 +907,7 @@ class CodeGenerator:
|
|||
def visitFrom(self, node):
|
||||
self.set_lineno(node)
|
||||
level = node.level
|
||||
if level == 0 and "absolute_import" not in self.futures:
|
||||
if level == 0 and not self.graph.checkFlag(CO_FUTURE_ABSIMPORT):
|
||||
level = -1
|
||||
fromlist = map(lambda (name, alias): name, node.names)
|
||||
if VERSION > 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue