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
2858a694
Commit
2858a694
authored
Jul 04, 2010
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9128: Fix validation of class decorators in parser module.
parent
fa9bc311
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
Lib/test/test_parser.py
Lib/test/test_parser.py
+7
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/parsermodule.c
Modules/parsermodule.c
+9
-8
No files found.
Lib/test/test_parser.py
View file @
2858a694
...
...
@@ -149,6 +149,13 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
def
test_class_defs
(
self
):
self
.
check_suite
(
"class foo():pass"
)
self
.
check_suite
(
"class foo(object):pass"
)
self
.
check_suite
(
"@class_decorator
\
n
"
"class foo():pass"
)
self
.
check_suite
(
"@class_decorator(arg)
\
n
"
"class foo():pass"
)
self
.
check_suite
(
"@decorator1
\
n
"
"@decorator2
\
n
"
"class foo():pass"
)
def
test_import_from_statement
(
self
):
self
.
check_suite
(
"from sys.path import *"
)
...
...
Misc/NEWS
View file @
2858a694
...
...
@@ -468,6 +468,8 @@ C-API
Library
-------
- Issue #9128: Fix validation of class decorators in parser module.
- Issue #9094: python -m pickletools will now disassemble pickle files
listed in the command line arguments. See output of python -m
pickletools -h for more details.
...
...
Modules/parsermodule.c
View file @
2858a694
...
...
@@ -2512,10 +2512,11 @@ validate_decorated(node *tree)
int
nch
=
NCH
(
tree
);
int
ok
=
(
validate_ntype
(
tree
,
decorated
)
&&
(
nch
==
2
)
&&
validate_decorators
(
RCHILD
(
tree
,
-
2
))
&&
(
validate_funcdef
(
RCHILD
(
tree
,
-
1
))
||
validate_class
(
RCHILD
(
tree
,
-
1
)))
);
&&
validate_decorators
(
RCHILD
(
tree
,
-
2
)));
if
(
TYPE
(
RCHILD
(
tree
,
-
1
))
==
funcdef
)
ok
=
ok
&&
validate_funcdef
(
RCHILD
(
tree
,
-
1
));
else
ok
=
ok
&&
validate_class
(
RCHILD
(
tree
,
-
1
));
return
ok
;
}
...
...
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