Commit eeed0c78 authored by Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 67077 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67077 | benjamin.peterson | 2008-11-03 09:14:51 -0600 (Mon, 03 Nov 2008) | 1 line

  #4048 make the parser module accept relative imports as valid
........
parent 084ce7a5
import parser import parser
import os
import unittest import unittest
import sys import sys
from test import test_support from test import test_support
...@@ -179,6 +180,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase): ...@@ -179,6 +180,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
"from sys.path import (dirname, basename as my_basename)") "from sys.path import (dirname, basename as my_basename)")
self.check_suite( self.check_suite(
"from sys.path import (dirname, basename as my_basename,)") "from sys.path import (dirname, basename as my_basename,)")
self.check_suite("from .bogus import x")
def test_basic_import_statement(self): def test_basic_import_statement(self):
self.check_suite("import sys") self.check_suite("import sys")
......
...@@ -62,6 +62,7 @@ Eric Beser ...@@ -62,6 +62,7 @@ Eric Beser
Steven Bethard Steven Bethard
Stephen Bevan Stephen Bevan
Ron Bickers Ron Bickers
David Binger
Dominic Binks Dominic Binks
Philippe Biondi Philippe Biondi
Stuart Bishop Stuart Bishop
......
...@@ -12,6 +12,8 @@ What's New in Python 2.6.1 alpha 1 ...@@ -12,6 +12,8 @@ What's New in Python 2.6.1 alpha 1
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #4048: The parser module now correctly validates relative imports.
- Issue #4225: ``from __future__ import unicode_literals`` didn't work in an - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an
exec statement. exec statement.
......
...@@ -1879,10 +1879,10 @@ static int ...@@ -1879,10 +1879,10 @@ static int
count_from_dots(node *tree) count_from_dots(node *tree)
{ {
int i; int i;
for (i = 0; i < NCH(tree); i++) for (i = 1; i < NCH(tree); i++)
if (TYPE(CHILD(tree, i)) != DOT) if (TYPE(CHILD(tree, i)) != DOT)
break; break;
return i; return i-1;
} }
/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment