Bugs item #1488915, was opened at 2006-05-15 17:26
Message generated for change (Comment added) made by twouters
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: Closed
>Resolution: Fixed
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: Thomas Wouters (twouters)
Date: 2006-05-25 13:31

Message:
Logged In: YES 
user_id=34209

Actually, it was as simple as adding the '+' to the grammar,
because all the code already expected multiple dots. (My
first few patches actually did this right, but Guido
suggested an alternative (simpler) spelling of the Grammar
rule, and we both forgot the '+' :)

Fixed and testcase added in 46209 and 46210. Thanks!


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

Comment By: Georg Brandl (gbrandl)
Date: 2006-05-16 09: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
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to