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
47fb45a6
Commit
47fb45a6
authored
Nov 25, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check the return value of NEW_IDENTIFIER in some more places
parent
a1dd1c0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
Python/ast.c
Python/ast.c
+18
-9
No files found.
Python/ast.c
View file @
47fb45a6
...
@@ -654,6 +654,7 @@ static int
...
@@ -654,6 +654,7 @@ static int
handle_keywordonly_args
(
struct
compiling
*
c
,
const
node
*
n
,
int
start
,
handle_keywordonly_args
(
struct
compiling
*
c
,
const
node
*
n
,
int
start
,
asdl_seq
*
kwonlyargs
,
asdl_seq
*
kwdefaults
)
asdl_seq
*
kwonlyargs
,
asdl_seq
*
kwdefaults
)
{
{
PyObject
*
argname
;
node
*
ch
;
node
*
ch
;
expr_ty
expression
,
annotation
;
expr_ty
expression
,
annotation
;
arg_ty
arg
;
arg_ty
arg
;
...
@@ -690,11 +691,12 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start,
...
@@ -690,11 +691,12 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start,
annotation
=
NULL
;
annotation
=
NULL
;
}
}
ch
=
CHILD
(
ch
,
0
);
ch
=
CHILD
(
ch
,
0
);
arg
=
arg
(
NEW_IDENTIFIER
(
ch
),
annotation
,
c
->
c_arena
);
argname
=
NEW_IDENTIFIER
(
ch
);
if
(
!
arg
)
{
if
(
!
argname
)
ast_error
(
ch
,
"expecting name"
);
goto
error
;
arg
=
arg
(
argname
,
annotation
,
c
->
c_arena
);
if
(
!
arg
)
goto
error
;
goto
error
;
}
asdl_seq_SET
(
kwonlyargs
,
j
++
,
arg
);
asdl_seq_SET
(
kwonlyargs
,
j
++
,
arg
);
i
+=
2
;
/* the name and the comma */
i
+=
2
;
/* the name and the comma */
break
;
break
;
...
@@ -3000,7 +3002,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
...
@@ -3000,7 +3002,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
/* classdef: 'class' NAME ['(' arglist ')'] ':' suite */
/* classdef: 'class' NAME ['(' arglist ')'] ':' suite */
PyObject
*
classname
;
PyObject
*
classname
;
asdl_seq
*
s
;
asdl_seq
*
s
;
expr_ty
call
,
dummy
;
expr_ty
call
;
REQ
(
n
,
classdef
);
REQ
(
n
,
classdef
);
...
@@ -3028,10 +3030,17 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
...
@@ -3028,10 +3030,17 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
/* class NAME '(' arglist ')' ':' suite */
/* class NAME '(' arglist ')' ':' suite */
/* build up a fake Call node so we can extract its pieces */
/* build up a fake Call node so we can extract its pieces */
dummy
=
Name
(
NEW_IDENTIFIER
(
CHILD
(
n
,
1
)),
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
{
PyObject
*
dummy_name
;
expr_ty
dummy
;
dummy_name
=
NEW_IDENTIFIER
(
CHILD
(
n
,
1
));
if
(
!
dummy_name
)
return
NULL
;
dummy
=
Name
(
dummy_name
,
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
call
=
ast_for_call
(
c
,
CHILD
(
n
,
3
),
dummy
);
call
=
ast_for_call
(
c
,
CHILD
(
n
,
3
),
dummy
);
if
(
!
call
)
if
(
!
call
)
return
NULL
;
return
NULL
;
}
s
=
ast_for_suite
(
c
,
CHILD
(
n
,
6
));
s
=
ast_for_suite
(
c
,
CHILD
(
n
,
6
));
if
(
!
s
)
if
(
!
s
)
return
NULL
;
return
NULL
;
...
...
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