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
070f0abc
Commit
070f0abc
authored
Jun 30, 2010
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9125: Update parser module for "except ... as ..." syntax.
parent
20379135
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
Lib/test/test_parser.py
Lib/test/test_parser.py
+6
-0
Misc/NEWS
Misc/NEWS
+1
-0
Modules/parsermodule.c
Modules/parsermodule.c
+7
-4
No files found.
Lib/test/test_parser.py
View file @
070f0abc
...
@@ -235,6 +235,12 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
...
@@ -235,6 +235,12 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
self
.
check_suite
(
"try: pass
\
n
except: pass
\
n
else: pass
\
n
"
self
.
check_suite
(
"try: pass
\
n
except: pass
\
n
else: pass
\
n
"
"finally: pass
\
n
"
)
"finally: pass
\
n
"
)
def
test_except_clause
(
self
):
self
.
check_suite
(
"try: pass
\
n
except: pass
\
n
"
)
self
.
check_suite
(
"try: pass
\
n
except A: pass
\
n
"
)
self
.
check_suite
(
"try: pass
\
n
except A, e: pass
\
n
"
)
self
.
check_suite
(
"try: pass
\
n
except A as e: pass
\
n
"
)
def
test_position
(
self
):
def
test_position
(
self
):
# An absolutely minimal test of position information. Better
# An absolutely minimal test of position information. Better
# tests would be a big project.
# tests would be a big project.
...
...
Misc/NEWS
View file @
070f0abc
...
@@ -20,6 +20,7 @@ Library
...
@@ -20,6 +20,7 @@ Library
- Issue #9075: In the ssl module, remove the setting of a ``debug`` flag
- Issue #9075: In the ssl module, remove the setting of a ``debug`` flag
on an OpenSSL structure.
on an OpenSSL structure.
- Issue #9125: Add recognition of 'except ... as ...' syntax to parser module.
What's New in Python 2.7 release candidate 2?
What's New in Python 2.7 release candidate 2?
=============================================
=============================================
...
...
Modules/parsermodule.c
View file @
070f0abc
...
@@ -2126,10 +2126,13 @@ validate_except_clause(node *tree)
...
@@ -2126,10 +2126,13 @@ validate_except_clause(node *tree)
if
(
res
&&
(
nch
>
1
))
if
(
res
&&
(
nch
>
1
))
res
=
validate_test
(
CHILD
(
tree
,
1
));
res
=
validate_test
(
CHILD
(
tree
,
1
));
if
(
res
&&
(
nch
==
4
))
if
(
res
&&
(
nch
==
4
))
{
res
=
(
validate_comma
(
CHILD
(
tree
,
2
))
if
(
TYPE
(
CHILD
(
tree
,
2
))
==
NAME
)
&&
validate_test
(
CHILD
(
tree
,
3
)));
res
=
validate_name
(
CHILD
(
tree
,
2
),
"as"
);
else
res
=
validate_comma
(
CHILD
(
tree
,
2
));
res
=
res
&&
validate_test
(
CHILD
(
tree
,
3
));
}
return
(
res
);
return
(
res
);
}
}
...
...
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