Handle import as correctly.
This commit is contained in:
@@ -2527,7 +2527,12 @@ void print_src(PycRef<ASTNode> node, PycModule* mod)
|
||||
}
|
||||
} else {
|
||||
fprintf(pyc_output, "import ");
|
||||
print_src(import->name(), mod);
|
||||
PycRef<ASTNode> import_name = import->name();
|
||||
print_src(import_name, mod);
|
||||
if (!dest.cast<ASTName>()->name()->isEqual(import_name.cast<ASTName>()->name().cast<PycObject>())) {
|
||||
fprintf(pyc_output, " as ");
|
||||
print_src(dest, mod);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (src->type() == ASTNode::NODE_BINARY &&
|
||||
|
4
tests/test_import.py
Normal file
4
tests/test_import.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import sys
|
||||
import unittest as ut
|
||||
from logging import Logger, LogRecord
|
||||
from os import *
|
BIN
tests/test_import.pyc
Normal file
BIN
tests/test_import.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user