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
d01d396e
Commit
d01d396e
authored
Oct 12, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #4555: All exported C symbols are now prefixed with either "Py" or "_Py".
("make smelly" now clean)
parent
409b5384
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
86 deletions
+89
-86
Include/asdl.h
Include/asdl.h
+2
-2
Misc/NEWS
Misc/NEWS
+3
-0
Parser/asdl_c.py
Parser/asdl_c.py
+2
-2
Python/Python-ast.c
Python/Python-ast.c
+48
-48
Python/asdl.c
Python/asdl.c
+2
-2
Python/ast.c
Python/ast.c
+32
-32
No files found.
Include/asdl.h
View file @
d01d396e
...
...
@@ -25,8 +25,8 @@ typedef struct {
int
elements
[
1
];
}
asdl_int_seq
;
asdl_seq
*
asdl_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
);
asdl_int_seq
*
asdl_int_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
);
asdl_seq
*
_Py_
asdl_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
);
asdl_int_seq
*
_Py_
asdl_int_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
);
#define asdl_seq_GET(S, I) (S)->elements[(I)]
#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
...
...
Misc/NEWS
View file @
d01d396e
...
...
@@ -10,6 +10,9 @@ Projected release date: 2013-10-20
Core and Builtins
-----------------
- Issue #4555: All exported C symbols are now prefixed with either
"Py" or "_Py".
- Issue #19219: Speed up marshal.loads(), and make pyc files slightly
(5% to 10%) smaller.
...
...
Parser/asdl_c.py
View file @
d01d396e
...
...
@@ -519,9 +519,9 @@ class Obj2ModVisitor(PickleVisitor):
self
.
emit
(
"}"
,
depth
+
1
)
self
.
emit
(
"len = PyList_GET_SIZE(tmp);"
,
depth
+
1
)
if
self
.
isSimpleType
(
field
):
self
.
emit
(
"%s = asdl_int_seq_new(len, arena);"
%
field
.
name
,
depth
+
1
)
self
.
emit
(
"%s =
_Py_
asdl_int_seq_new(len, arena);"
%
field
.
name
,
depth
+
1
)
else
:
self
.
emit
(
"%s = asdl_seq_new(len, arena);"
%
field
.
name
,
depth
+
1
)
self
.
emit
(
"%s =
_Py_
asdl_seq_new(len, arena);"
%
field
.
name
,
depth
+
1
)
self
.
emit
(
"if (%s == NULL) goto failed;"
%
field
.
name
,
depth
+
1
)
self
.
emit
(
"for (i = 0; i < len; i++) {"
,
depth
+
1
)
self
.
emit
(
"%s value;"
%
ctype
,
depth
+
2
)
...
...
Python/Python-ast.c
View file @
d01d396e
...
...
@@ -3612,7 +3612,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -3647,7 +3647,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -3704,7 +3704,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -3807,7 +3807,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -3831,7 +3831,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
decorator_list
=
asdl_seq_new
(
len
,
arena
);
decorator_list
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
decorator_list
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -3894,7 +3894,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
bases
=
asdl_seq_new
(
len
,
arena
);
bases
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
bases
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -3918,7 +3918,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
keywords
=
asdl_seq_new
(
len
,
arena
);
keywords
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
keywords
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
keyword_ty
value
;
...
...
@@ -3962,7 +3962,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -3986,7 +3986,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
decorator_list
=
asdl_seq_new
(
len
,
arena
);
decorator_list
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
decorator_list
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -4043,7 +4043,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
targets
=
asdl_seq_new
(
len
,
arena
);
targets
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
targets
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -4079,7 +4079,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
targets
=
asdl_seq_new
(
len
,
arena
);
targets
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
targets
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -4196,7 +4196,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4220,7 +4220,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
orelse
=
asdl_seq_new
(
len
,
arena
);
orelse
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
orelse
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4268,7 +4268,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4292,7 +4292,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
orelse
=
asdl_seq_new
(
len
,
arena
);
orelse
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
orelse
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4340,7 +4340,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4364,7 +4364,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
orelse
=
asdl_seq_new
(
len
,
arena
);
orelse
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
orelse
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4400,7 +4400,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
items
=
asdl_seq_new
(
len
,
arena
);
items
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
items
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
withitem_ty
value
;
...
...
@@ -4424,7 +4424,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4494,7 +4494,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4518,7 +4518,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
handlers
=
asdl_seq_new
(
len
,
arena
);
handlers
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
handlers
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
excepthandler_ty
value
;
...
...
@@ -4542,7 +4542,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
orelse
=
asdl_seq_new
(
len
,
arena
);
orelse
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
orelse
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4566,7 +4566,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
finalbody
=
asdl_seq_new
(
len
,
arena
);
finalbody
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
finalbody
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -4635,7 +4635,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
names
=
asdl_seq_new
(
len
,
arena
);
names
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
names
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
alias_ty
value
;
...
...
@@ -4682,7 +4682,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
names
=
asdl_seq_new
(
len
,
arena
);
names
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
names
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
alias_ty
value
;
...
...
@@ -4727,7 +4727,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
names
=
asdl_seq_new
(
len
,
arena
);
names
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
names
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
identifier
value
;
...
...
@@ -4762,7 +4762,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
names
=
asdl_seq_new
(
len
,
arena
);
names
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
names
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
identifier
value
;
...
...
@@ -4903,7 +4903,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
values
=
asdl_seq_new
(
len
,
arena
);
values
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
values
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5099,7 +5099,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
keys
=
asdl_seq_new
(
len
,
arena
);
keys
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
keys
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5123,7 +5123,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
values
=
asdl_seq_new
(
len
,
arena
);
values
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
values
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5158,7 +5158,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
elts
=
asdl_seq_new
(
len
,
arena
);
elts
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
elts
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5205,7 +5205,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
generators
=
asdl_seq_new
(
len
,
arena
);
generators
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
generators
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
comprehension_ty
value
;
...
...
@@ -5252,7 +5252,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
generators
=
asdl_seq_new
(
len
,
arena
);
generators
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
generators
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
comprehension_ty
value
;
...
...
@@ -5311,7 +5311,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
generators
=
asdl_seq_new
(
len
,
arena
);
generators
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
generators
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
comprehension_ty
value
;
...
...
@@ -5358,7 +5358,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
generators
=
asdl_seq_new
(
len
,
arena
);
generators
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
generators
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
comprehension_ty
value
;
...
...
@@ -5449,7 +5449,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
ops
=
asdl_int_seq_new
(
len
,
arena
);
ops
=
_Py_
asdl_int_seq_new
(
len
,
arena
);
if
(
ops
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
cmpop_ty
value
;
...
...
@@ -5473,7 +5473,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
comparators
=
asdl_seq_new
(
len
,
arena
);
comparators
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
comparators
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5523,7 +5523,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
args
=
asdl_seq_new
(
len
,
arena
);
args
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
args
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5547,7 +5547,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
keywords
=
asdl_seq_new
(
len
,
arena
);
keywords
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
keywords
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
keyword_ty
value
;
...
...
@@ -5862,7 +5862,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
elts
=
asdl_seq_new
(
len
,
arena
);
elts
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
elts
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -5909,7 +5909,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
elts
=
asdl_seq_new
(
len
,
arena
);
elts
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
elts
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -6074,7 +6074,7 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
dims
=
asdl_seq_new
(
len
,
arena
);
dims
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
dims
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
slice_ty
value
;
...
...
@@ -6425,7 +6425,7 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
ifs
=
asdl_seq_new
(
len
,
arena
);
ifs
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
ifs
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -6520,7 +6520,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
body
=
asdl_seq_new
(
len
,
arena
);
body
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
body
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
stmt_ty
value
;
...
...
@@ -6566,7 +6566,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
args
=
asdl_seq_new
(
len
,
arena
);
args
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
args
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
arg_ty
value
;
...
...
@@ -6600,7 +6600,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
kwonlyargs
=
asdl_seq_new
(
len
,
arena
);
kwonlyargs
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
kwonlyargs
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
arg_ty
value
;
...
...
@@ -6624,7 +6624,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
kw_defaults
=
asdl_seq_new
(
len
,
arena
);
kw_defaults
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
kw_defaults
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
@@ -6658,7 +6658,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
goto
failed
;
}
len
=
PyList_GET_SIZE
(
tmp
);
defaults
=
asdl_seq_new
(
len
,
arena
);
defaults
=
_Py_
asdl_seq_new
(
len
,
arena
);
if
(
defaults
==
NULL
)
goto
failed
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
expr_ty
value
;
...
...
Python/asdl.c
View file @
d01d396e
...
...
@@ -2,7 +2,7 @@
#include "asdl.h"
asdl_seq
*
asdl_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
)
_Py_
asdl_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
)
{
asdl_seq
*
seq
=
NULL
;
size_t
n
=
(
size
?
(
sizeof
(
void
*
)
*
(
size
-
1
))
:
0
);
...
...
@@ -33,7 +33,7 @@ asdl_seq_new(Py_ssize_t size, PyArena *arena)
}
asdl_int_seq
*
asdl_int_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
)
_Py_
asdl_int_seq_new
(
Py_ssize_t
size
,
PyArena
*
arena
)
{
asdl_int_seq
*
seq
=
NULL
;
size_t
n
=
(
size
?
(
sizeof
(
void
*
)
*
(
size
-
1
))
:
0
);
...
...
Python/ast.c
View file @
d01d396e
...
...
@@ -696,7 +696,7 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
k
=
0
;
switch
(
TYPE
(
n
))
{
case
file_input
:
stmts
=
asdl_seq_new
(
num_stmts
(
n
),
arena
);
stmts
=
_Py_
asdl_seq_new
(
num_stmts
(
n
),
arena
);
if
(
!
stmts
)
goto
out
;
for
(
i
=
0
;
i
<
NCH
(
n
)
-
1
;
i
++
)
{
...
...
@@ -736,7 +736,7 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
}
case
single_input
:
if
(
TYPE
(
CHILD
(
n
,
0
))
==
NEWLINE
)
{
stmts
=
asdl_seq_new
(
1
,
arena
);
stmts
=
_Py_
asdl_seq_new
(
1
,
arena
);
if
(
!
stmts
)
goto
out
;
asdl_seq_SET
(
stmts
,
0
,
Pass
(
n
->
n_lineno
,
n
->
n_col_offset
,
...
...
@@ -748,7 +748,7 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
else
{
n
=
CHILD
(
n
,
0
);
num
=
num_stmts
(
n
);
stmts
=
asdl_seq_new
(
num
,
arena
);
stmts
=
_Py_
asdl_seq_new
(
num
,
arena
);
if
(
!
stmts
)
goto
out
;
if
(
num
==
1
)
{
...
...
@@ -1099,7 +1099,7 @@ seq_for_testlist(struct compiling *c, const node *n)
int
i
;
assert
(
TYPE
(
n
)
==
testlist
||
TYPE
(
n
)
==
testlist_star_expr
||
TYPE
(
n
)
==
testlist_comp
);
seq
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
seq
=
_Py_
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
seq
)
return
NULL
;
...
...
@@ -1279,22 +1279,22 @@ ast_for_arguments(struct compiling *c, const node *n)
if
(
TYPE
(
ch
)
==
DOUBLESTAR
)
break
;
if
(
TYPE
(
ch
)
==
tfpdef
||
TYPE
(
ch
)
==
vfpdef
)
nkwonlyargs
++
;
}
posargs
=
(
nposargs
?
asdl_seq_new
(
nposargs
,
c
->
c_arena
)
:
NULL
);
posargs
=
(
nposargs
?
_Py_
asdl_seq_new
(
nposargs
,
c
->
c_arena
)
:
NULL
);
if
(
!
posargs
&&
nposargs
)
return
NULL
;
kwonlyargs
=
(
nkwonlyargs
?
asdl_seq_new
(
nkwonlyargs
,
c
->
c_arena
)
:
NULL
);
_Py_
asdl_seq_new
(
nkwonlyargs
,
c
->
c_arena
)
:
NULL
);
if
(
!
kwonlyargs
&&
nkwonlyargs
)
return
NULL
;
posdefaults
=
(
nposdefaults
?
asdl_seq_new
(
nposdefaults
,
c
->
c_arena
)
:
NULL
);
_Py_
asdl_seq_new
(
nposdefaults
,
c
->
c_arena
)
:
NULL
);
if
(
!
posdefaults
&&
nposdefaults
)
return
NULL
;
/* The length of kwonlyargs and kwdefaults are same
since we set NULL as default for keyword only argument w/o default
- we have sequence data structure, but no dictionary */
kwdefaults
=
(
nkwonlyargs
?
asdl_seq_new
(
nkwonlyargs
,
c
->
c_arena
)
:
NULL
);
_Py_
asdl_seq_new
(
nkwonlyargs
,
c
->
c_arena
)
:
NULL
);
if
(
!
kwdefaults
&&
nkwonlyargs
)
return
NULL
;
...
...
@@ -1462,7 +1462,7 @@ ast_for_decorators(struct compiling *c, const node *n)
int
i
;
REQ
(
n
,
decorators
);
decorator_seq
=
asdl_seq_new
(
NCH
(
n
),
c
->
c_arena
);
decorator_seq
=
_Py_
asdl_seq_new
(
NCH
(
n
),
c
->
c_arena
);
if
(
!
decorator_seq
)
return
NULL
;
...
...
@@ -1658,7 +1658,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
if
(
n_fors
==
-
1
)
return
NULL
;
comps
=
asdl_seq_new
(
n_fors
,
c
->
c_arena
);
comps
=
_Py_
asdl_seq_new
(
n_fors
,
c
->
c_arena
);
if
(
!
comps
)
return
NULL
;
...
...
@@ -1699,7 +1699,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
if
(
n_ifs
==
-
1
)
return
NULL
;
ifs
=
asdl_seq_new
(
n_ifs
,
c
->
c_arena
);
ifs
=
_Py_
asdl_seq_new
(
n_ifs
,
c
->
c_arena
);
if
(
!
ifs
)
return
NULL
;
...
...
@@ -1921,7 +1921,7 @@ ast_for_atom(struct compiling *c, const node *n)
/* it's a simple set */
asdl_seq
*
elts
;
size
=
(
NCH
(
ch
)
+
1
)
/
2
;
/* +1 in case no trailing comma */
elts
=
asdl_seq_new
(
size
,
c
->
c_arena
);
elts
=
_Py_
asdl_seq_new
(
size
,
c
->
c_arena
);
if
(
!
elts
)
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
ch
);
i
+=
2
)
{
...
...
@@ -1940,11 +1940,11 @@ ast_for_atom(struct compiling *c, const node *n)
}
else
{
/* it's a dict */
size
=
(
NCH
(
ch
)
+
1
)
/
4
;
/* +1 in case no trailing comma */
keys
=
asdl_seq_new
(
size
,
c
->
c_arena
);
keys
=
_Py_
asdl_seq_new
(
size
,
c
->
c_arena
);
if
(
!
keys
)
return
NULL
;
values
=
asdl_seq_new
(
size
,
c
->
c_arena
);
values
=
_Py_
asdl_seq_new
(
size
,
c
->
c_arena
);
if
(
!
values
)
return
NULL
;
...
...
@@ -2139,7 +2139,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
expr_ty
e
;
int
simple
=
1
;
asdl_seq
*
slices
,
*
elts
;
slices
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
slices
=
_Py_
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
slices
)
return
NULL
;
for
(
j
=
0
;
j
<
NCH
(
n
);
j
+=
2
)
{
...
...
@@ -2155,7 +2155,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
}
/* extract Index values and put them in a Tuple */
elts
=
asdl_seq_new
(
asdl_seq_LEN
(
slices
),
c
->
c_arena
);
elts
=
_Py_
asdl_seq_new
(
asdl_seq_LEN
(
slices
),
c
->
c_arena
);
if
(
!
elts
)
return
NULL
;
for
(
j
=
0
;
j
<
asdl_seq_LEN
(
slices
);
++
j
)
{
...
...
@@ -2288,7 +2288,7 @@ ast_for_expr(struct compiling *c, const node *n)
n
=
CHILD
(
n
,
0
);
goto
loop
;
}
seq
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
seq
=
_Py_
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
seq
)
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
n
);
i
+=
2
)
{
...
...
@@ -2324,10 +2324,10 @@ ast_for_expr(struct compiling *c, const node *n)
expr_ty
expression
;
asdl_int_seq
*
ops
;
asdl_seq
*
cmps
;
ops
=
asdl_int_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
ops
=
_Py_
asdl_int_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
if
(
!
ops
)
return
NULL
;
cmps
=
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
cmps
=
_Py_
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
if
(
!
cmps
)
{
return
NULL
;
}
...
...
@@ -2453,10 +2453,10 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
return
NULL
;
}
args
=
asdl_seq_new
(
nargs
+
ngens
,
c
->
c_arena
);
args
=
_Py_
asdl_seq_new
(
nargs
+
ngens
,
c
->
c_arena
);
if
(
!
args
)
return
NULL
;
keywords
=
asdl_seq_new
(
nkeywords
,
c
->
c_arena
);
keywords
=
_Py_
asdl_seq_new
(
nkeywords
,
c
->
c_arena
);
if
(
!
keywords
)
return
NULL
;
nargs
=
0
;
...
...
@@ -2633,7 +2633,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
/* a normal assignment */
REQ
(
CHILD
(
n
,
1
),
EQUAL
);
targets
=
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
targets
=
_Py_
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
if
(
!
targets
)
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
n
)
-
2
;
i
+=
2
)
{
...
...
@@ -2674,7 +2674,7 @@ ast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context)
REQ
(
n
,
exprlist
);
seq
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
seq
=
_Py_
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
seq
)
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
n
);
i
+=
2
)
{
...
...
@@ -2904,7 +2904,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
if
(
TYPE
(
n
)
==
import_name
)
{
n
=
CHILD
(
n
,
1
);
REQ
(
n
,
dotted_as_names
);
aliases
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
aliases
=
_Py_
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
aliases
)
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
n
);
i
+=
2
)
{
...
...
@@ -2966,7 +2966,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
return
NULL
;
}
aliases
=
asdl_seq_new
((
n_children
+
1
)
/
2
,
c
->
c_arena
);
aliases
=
_Py_
asdl_seq_new
((
n_children
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
aliases
)
return
NULL
;
...
...
@@ -3005,7 +3005,7 @@ ast_for_global_stmt(struct compiling *c, const node *n)
int
i
;
REQ
(
n
,
global_stmt
);
s
=
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
s
=
_Py_
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
if
(
!
s
)
return
NULL
;
for
(
i
=
1
;
i
<
NCH
(
n
);
i
+=
2
)
{
...
...
@@ -3026,7 +3026,7 @@ ast_for_nonlocal_stmt(struct compiling *c, const node *n)
int
i
;
REQ
(
n
,
nonlocal_stmt
);
s
=
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
s
=
_Py_
asdl_seq_new
(
NCH
(
n
)
/
2
,
c
->
c_arena
);
if
(
!
s
)
return
NULL
;
for
(
i
=
1
;
i
<
NCH
(
n
);
i
+=
2
)
{
...
...
@@ -3079,7 +3079,7 @@ ast_for_suite(struct compiling *c, const node *n)
REQ
(
n
,
suite
);
total
=
num_stmts
(
n
);
seq
=
asdl_seq_new
(
total
,
c
->
c_arena
);
seq
=
_Py_
asdl_seq_new
(
total
,
c
->
c_arena
);
if
(
!
seq
)
return
NULL
;
if
(
TYPE
(
CHILD
(
n
,
0
))
==
simple_stmt
)
{
...
...
@@ -3198,7 +3198,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
if
(
has_else
)
{
asdl_seq
*
suite_seq2
;
orelse
=
asdl_seq_new
(
1
,
c
->
c_arena
);
orelse
=
_Py_
asdl_seq_new
(
1
,
c
->
c_arena
);
if
(
!
orelse
)
return
NULL
;
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
NCH
(
n
)
-
6
));
...
...
@@ -3222,7 +3222,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
for
(
i
=
0
;
i
<
n_elif
;
i
++
)
{
int
off
=
5
+
(
n_elif
-
i
-
1
)
*
4
;
asdl_seq
*
newobj
=
asdl_seq_new
(
1
,
c
->
c_arena
);
asdl_seq
*
newobj
=
_Py_
asdl_seq_new
(
1
,
c
->
c_arena
);
if
(
!
newobj
)
return
NULL
;
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
off
));
...
...
@@ -3434,7 +3434,7 @@ ast_for_try_stmt(struct compiling *c, const node *n)
if
(
n_except
>
0
)
{
int
i
;
/* process except statements to create a try ... except */
handlers
=
asdl_seq_new
(
n_except
,
c
->
c_arena
);
handlers
=
_Py_
asdl_seq_new
(
n_except
,
c
->
c_arena
);
if
(
handlers
==
NULL
)
return
NULL
;
...
...
@@ -3485,7 +3485,7 @@ ast_for_with_stmt(struct compiling *c, const node *n)
REQ
(
n
,
with_stmt
);
n_items
=
(
NCH
(
n
)
-
2
)
/
2
;
items
=
asdl_seq_new
(
n_items
,
c
->
c_arena
);
items
=
_Py_
asdl_seq_new
(
n_items
,
c
->
c_arena
);
if
(
!
items
)
return
NULL
;
for
(
i
=
1
;
i
<
NCH
(
n
)
-
2
;
i
+=
2
)
{
...
...
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