From: Stefan Behnel Date: Fri, 14 Nov 2008 20:53:41 +0000 (+0100) Subject: fix Python level 'import as' of packages X-Git-Tag: 0.11-beta~250 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0e4a04347de5a976b374220770617ccf5dccccb2;p=cython.git fix Python level 'import as' of packages --- diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 529b9876..b79615c9 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -996,7 +996,8 @@ def p_import_statement(s): else: if as_name and "." in dotted_name: name_list = ExprNodes.ListNode(pos, args = [ - ExprNodes.StringNode(pos, value = EncodedString("*"))]) + ExprNodes.IdentifierStringNode( + pos, value = EncodedString("*"))]) else: name_list = None stat = Nodes.SingleAssignmentNode(pos, diff --git a/tests/run/importas.pyx b/tests/run/importas.pyx index 6eb84e8b..c57b057a 100644 --- a/tests/run/importas.pyx +++ b/tests/run/importas.pyx @@ -2,6 +2,7 @@ __doc__ = u""" >>> import sys as sous >>> import distutils.core as corey >>> from copy import deepcopy as copey +>>> import distutils.command as commie >>> sous is _sous True @@ -9,6 +10,8 @@ True True >>> copey is _copey True +>>> _commie is commie +True >>> _sous is not None True @@ -16,6 +19,8 @@ True True >>> _copey is not None True +>>> _commie is not None +True >>> print(_sous.__name__) sys @@ -29,8 +34,13 @@ distutils.core deepcopy >>> print(copey.__name__) deepcopy +>>> print(_commie.__name__) +distutils.command +>>> print(commie.__name__) +distutils.command """ import sys as _sous import distutils.core as _corey from copy import deepcopy as _copey +import distutils.command as _commie