Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6f08e85a
Commit
6f08e85a
authored
Nov 03, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backport r67077 from the trunk: parser module now correctly validates relative imports
parent
3b335ff3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
2 deletions
+7
-2
Lib/test/test_parser.py
Lib/test/test_parser.py
+2
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/parsermodule.c
Modules/parsermodule.c
+2
-2
No files found.
Lib/test/test_parser.py
View file @
6f08e85a
import
parser
import
os
import
unittest
from
test
import
test_support
...
...
@@ -168,6 +169,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
"from sys.path import (dirname, basename as my_basename)"
)
self
.
check_suite
(
"from sys.path import (dirname, basename as my_basename,)"
)
self
.
check_suite
(
"from .bogus import x"
)
def
test_basic_import_statement
(
self
):
self
.
check_suite
(
"import sys"
)
...
...
Misc/ACKS
View file @
6f08e85a
...
...
@@ -60,6 +60,7 @@ Eric Beser
Steven Bethard
Stephen Bevan
Ron Bickers
David Binger
Dominic Binks
Philippe Biondi
Stuart Bishop
...
...
Misc/NEWS
View file @
6f08e85a
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.5.3?
Core and builtins
-----------------
- Issue #4048: The parser module now correctly validates relative imports.
- Issue #4176: Fixed a crash when pickling an object which ``__reduce__``
method does not return iterators for the 4th and 5th items.
...
...
Modules/parsermodule.c
View file @
6f08e85a
...
...
@@ -1804,10 +1804,10 @@ static int
count_from_dots
(
node
*
tree
)
{
int
i
;
for
(
i
=
0
;
i
<
NCH
(
tree
);
i
++
)
for
(
i
=
1
;
i
<
NCH
(
tree
);
i
++
)
if
(
TYPE
(
CHILD
(
tree
,
i
))
!=
DOT
)
break
;
return
i
;
return
i
-
1
;
}
/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment