[ python-Bugs-1488915 ] Multiple dots in relative import statement raise SyntaxError

SourceForge.net noreply at sourceforge.net
Tue May 16 09:25:17 CEST 2006


Bugs item #1488915, was opened at 2006-05-15 15:26
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488915&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Žiga Seilnacht (zseil)
Assigned to: Thomas Wouters (twouters)
Summary: Multiple dots in relative import statement raise SyntaxError

Initial Comment:
When a relative import statement contains more than
one period and no module name, SyntaxError is raised.
Example:

from  .  import  spam       # this works
from  ..spam  import  eggs  # this works
from  ..  import  eggs      # this raises SyntaxError

The problem is in the following line in Grammar/Grammar:

import_from: ('from' ('.'* dotted_name | '.')

According to Guido's mail:
http://mail.python.org/pipermail/python-dev/2003-December/041065.html
that line should be:

import_from: ('from' ('.'* dotted_name | '.'+)

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-05-16 07:25

Message:
Logged In: YES 
user_id=849994

Assigned to Thomas. It doesn't seem as simple as adding the
"+" in Grammar.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488915&group_id=5470


More information about the Python-bugs-list mailing list