Correct a couple of bugs...

We weren't distinguising relative imports from absolute imports.
Fixes #444

Picking out docstring was broken too.
This commit is contained in:
rocky
2023-04-17 16:35:27 -04:00
parent b6aa58790f
commit 7ad0c37c62
4 changed files with 22 additions and 24 deletions

View File

@@ -783,7 +783,7 @@ class NonterminalActions:
def n_import_from(self, node):
relative_path_index = 0
if self.version >= (2, 5):
if node[relative_path_index].attr > 0:
if node[relative_path_index].pattr > 0:
node[2].pattr = ("." * node[relative_path_index].attr) + node[2].pattr
if self.version > (2, 7):
if isinstance(node[1].pattr, tuple):