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
77fa9379
Commit
77fa9379
authored
May 15, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Py_ssize_t for ast sequence lengths
parent
c5f31ed6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
Parser/asdl_c.py
Parser/asdl_c.py
+2
-2
Python/Python-ast.c
Python/Python-ast.c
+2
-2
No files found.
Parser/asdl_c.py
View file @
77fa9379
...
@@ -784,7 +784,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
...
@@ -784,7 +784,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
{
{
in
t i, n = asdl_seq_LEN(seq);
Py_ssize_
t i, n = asdl_seq_LEN(seq);
PyObject *result = PyList_New(n);
PyObject *result = PyList_New(n);
PyObject *value;
PyObject *value;
if (!result)
if (!result)
...
@@ -1106,7 +1106,7 @@ class ObjVisitor(PickleVisitor):
...
@@ -1106,7 +1106,7 @@ class ObjVisitor(PickleVisitor):
# While the sequence elements are stored as void*,
# While the sequence elements are stored as void*,
# ast2obj_cmpop expects an enum
# ast2obj_cmpop expects an enum
self
.
emit
(
"{"
,
depth
)
self
.
emit
(
"{"
,
depth
)
self
.
emit
(
"
in
t i, n = asdl_seq_LEN(%s);"
%
value
,
depth
+
1
)
self
.
emit
(
"
Py_ssize_
t i, n = asdl_seq_LEN(%s);"
%
value
,
depth
+
1
)
self
.
emit
(
"value = PyList_New(n);"
,
depth
+
1
)
self
.
emit
(
"value = PyList_New(n);"
,
depth
+
1
)
self
.
emit
(
"if (!value) goto failed;"
,
depth
+
1
)
self
.
emit
(
"if (!value) goto failed;"
,
depth
+
1
)
self
.
emit
(
"for(i = 0; i < n; i++)"
,
depth
+
1
)
self
.
emit
(
"for(i = 0; i < n; i++)"
,
depth
+
1
)
...
...
Python/Python-ast.c
View file @
77fa9379
...
@@ -636,7 +636,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
...
@@ -636,7 +636,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
static
PyObject
*
ast2obj_list
(
asdl_seq
*
seq
,
PyObject
*
(
*
func
)(
void
*
))
static
PyObject
*
ast2obj_list
(
asdl_seq
*
seq
,
PyObject
*
(
*
func
)(
void
*
))
{
{
in
t
i
,
n
=
asdl_seq_LEN
(
seq
);
Py_ssize_
t
i
,
n
=
asdl_seq_LEN
(
seq
);
PyObject
*
result
=
PyList_New
(
n
);
PyObject
*
result
=
PyList_New
(
n
);
PyObject
*
value
;
PyObject
*
value
;
if
(
!
result
)
if
(
!
result
)
...
@@ -2857,7 +2857,7 @@ ast2obj_expr(void* _o)
...
@@ -2857,7 +2857,7 @@ ast2obj_expr(void* _o)
goto
failed
;
goto
failed
;
Py_DECREF
(
value
);
Py_DECREF
(
value
);
{
{
in
t
i
,
n
=
asdl_seq_LEN
(
o
->
v
.
Compare
.
ops
);
Py_ssize_
t
i
,
n
=
asdl_seq_LEN
(
o
->
v
.
Compare
.
ops
);
value
=
PyList_New
(
n
);
value
=
PyList_New
(
n
);
if
(
!
value
)
goto
failed
;
if
(
!
value
)
goto
failed
;
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
n
;
i
++
)
...
...
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