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
cf7182fb
Commit
cf7182fb
authored
May 15, 2012
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Widen ASDL sequences to Py_ssize_t lengths to better match PEP 353.
parent
e04670af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
Include/asdl.h
Include/asdl.h
+4
-4
Python/Python-ast.c
Python/Python-ast.c
+2
-2
Python/asdl.c
Python/asdl.c
+2
-2
No files found.
Include/asdl.h
View file @
cf7182fb
...
...
@@ -15,17 +15,17 @@ typedef PyObject * object;
/* XXX A sequence should be typed so that its use can be typechecked. */
typedef
struct
{
in
t
size
;
Py_ssize_
t
size
;
void
*
elements
[
1
];
}
asdl_seq
;
typedef
struct
{
in
t
size
;
Py_ssize_
t
size
;
int
elements
[
1
];
}
asdl_int_seq
;
asdl_seq
*
asdl_seq_new
(
in
t
size
,
PyArena
*
arena
);
asdl_int_seq
*
asdl_int_seq_new
(
in
t
size
,
PyArena
*
arena
);
asdl_seq
*
asdl_seq_new
(
Py_ssize_
t
size
,
PyArena
*
arena
);
asdl_int_seq
*
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)
...
...
Python/Python-ast.c
View file @
cf7182fb
...
...
@@ -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
*
))
{
in
t
i
,
n
=
asdl_seq_LEN
(
seq
);
Py_ssize_
t
i
,
n
=
asdl_seq_LEN
(
seq
);
PyObject
*
result
=
PyList_New
(
n
);
PyObject
*
value
;
if
(
!
result
)
...
...
@@ -2857,7 +2857,7 @@ ast2obj_expr(void* _o)
goto
failed
;
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
);
if
(
!
value
)
goto
failed
;
for
(
i
=
0
;
i
<
n
;
i
++
)
...
...
Python/asdl.c
View file @
cf7182fb
...
...
@@ -2,7 +2,7 @@
#include "asdl.h"
asdl_seq
*
asdl_seq_new
(
in
t
size
,
PyArena
*
arena
)
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(int size, PyArena *arena)
}
asdl_int_seq
*
asdl_int_seq_new
(
in
t
size
,
PyArena
*
arena
)
asdl_int_seq_new
(
Py_ssize_
t
size
,
PyArena
*
arena
)
{
asdl_int_seq
*
seq
=
NULL
;
size_t
n
=
(
size
?
(
sizeof
(
void
*
)
*
(
size
-
1
))
:
0
);
...
...
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