Mercurial > cpython-lru_cache-weakref
annotate Python/Python-ast.c @ 41722:d3cd2920beb6
Obsubmit.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 15 May 2007 20:34:04 +0000 |
| parents | 9ad84070b22d |
| children | 24b60622b944 |
| rev | line source |
|---|---|
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
1 /* File automatically generated by Parser/asdl_c.py. */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
2 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
3 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
4 /* |
| 41722 | 5 __version__ 55343. |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
6 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
7 This module must be committed separately after each AST grammar change; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
8 The __version__ number is set to the revision number of the commit |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
9 containing the grammar change. |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40819
diff
changeset
|
10 */ |
| 35742 | 11 |
| 12 #include "Python.h" | |
| 13 #include "Python-ast.h" | |
| 14 | |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
15 static PyTypeObject* AST_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
16 static PyTypeObject *mod_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
17 static PyObject* ast2obj_mod(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
18 static PyTypeObject *Module_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
19 static char *Module_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
20 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
21 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
22 static PyTypeObject *Interactive_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
23 static char *Interactive_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
24 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
25 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
26 static PyTypeObject *Expression_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
27 static char *Expression_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
28 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
29 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
30 static PyTypeObject *Suite_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
31 static char *Suite_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
32 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
33 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
34 static PyTypeObject *stmt_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
35 static char *stmt_attributes[] = { |
| 36669 | 36 "lineno", |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
37 "col_offset", |
| 36669 | 38 }; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
39 static PyObject* ast2obj_stmt(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
40 static PyTypeObject *FunctionDef_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
41 static char *FunctionDef_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
42 "name", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
43 "args", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
44 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
45 "decorators", |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
46 "returns", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
47 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
48 static PyTypeObject *ClassDef_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
49 static char *ClassDef_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
50 "name", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
51 "bases", |
|
41226
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
52 "keywords", |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
53 "starargs", |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
54 "kwargs", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
55 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
56 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
57 static PyTypeObject *Return_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
58 static char *Return_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
59 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
60 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
61 static PyTypeObject *Delete_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
62 static char *Delete_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
63 "targets", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
64 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
65 static PyTypeObject *Assign_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
66 static char *Assign_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
67 "targets", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
68 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
69 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
70 static PyTypeObject *AugAssign_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
71 static char *AugAssign_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
72 "target", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
73 "op", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
74 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
75 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
76 static PyTypeObject *For_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
77 static char *For_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
78 "target", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
79 "iter", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
80 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
81 "orelse", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
82 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
83 static PyTypeObject *While_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
84 static char *While_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
85 "test", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
86 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
87 "orelse", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
88 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
89 static PyTypeObject *If_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
90 static char *If_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
91 "test", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
92 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
93 "orelse", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
94 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
95 static PyTypeObject *With_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
96 static char *With_fields[]={ |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
97 "context_expr", |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
98 "optional_vars", |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
99 "body", |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
100 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
101 static PyTypeObject *Raise_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
102 static char *Raise_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
103 "type", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
104 "inst", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
105 "tback", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
106 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
107 static PyTypeObject *TryExcept_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
108 static char *TryExcept_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
109 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
110 "handlers", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
111 "orelse", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
112 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
113 static PyTypeObject *TryFinally_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
114 static char *TryFinally_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
115 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
116 "finalbody", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
117 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
118 static PyTypeObject *Assert_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
119 static char *Assert_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
120 "test", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
121 "msg", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
122 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
123 static PyTypeObject *Import_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
124 static char *Import_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
125 "names", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
126 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
127 static PyTypeObject *ImportFrom_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
128 static char *ImportFrom_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
129 "module", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
130 "names", |
|
36712
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
131 "level", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
132 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
133 static PyTypeObject *Global_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
134 static char *Global_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
135 "names", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
136 }; |
|
40965
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
137 static PyTypeObject *Nonlocal_type; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
138 static char *Nonlocal_fields[]={ |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
139 "names", |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
140 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
141 static PyTypeObject *Expr_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
142 static char *Expr_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
143 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
144 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
145 static PyTypeObject *Pass_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
146 static PyTypeObject *Break_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
147 static PyTypeObject *Continue_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
148 static PyTypeObject *expr_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
149 static char *expr_attributes[] = { |
| 36669 | 150 "lineno", |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
151 "col_offset", |
| 36669 | 152 }; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
153 static PyObject* ast2obj_expr(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
154 static PyTypeObject *BoolOp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
155 static char *BoolOp_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
156 "op", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
157 "values", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
158 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
159 static PyTypeObject *BinOp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
160 static char *BinOp_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
161 "left", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
162 "op", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
163 "right", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
164 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
165 static PyTypeObject *UnaryOp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
166 static char *UnaryOp_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
167 "op", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
168 "operand", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
169 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
170 static PyTypeObject *Lambda_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
171 static char *Lambda_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
172 "args", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
173 "body", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
174 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
175 static PyTypeObject *IfExp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
176 static char *IfExp_fields[]={ |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
177 "test", |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
178 "body", |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
179 "orelse", |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
180 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
181 static PyTypeObject *Dict_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
182 static char *Dict_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
183 "keys", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
184 "values", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
185 }; |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
186 static PyTypeObject *Set_type; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
187 static char *Set_fields[]={ |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
188 "elts", |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
189 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
190 static PyTypeObject *ListComp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
191 static char *ListComp_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
192 "elt", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
193 "generators", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
194 }; |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
195 static PyTypeObject *SetComp_type; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
196 static char *SetComp_fields[]={ |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
197 "elt", |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
198 "generators", |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
199 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
200 static PyTypeObject *GeneratorExp_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
201 static char *GeneratorExp_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
202 "elt", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
203 "generators", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
204 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
205 static PyTypeObject *Yield_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
206 static char *Yield_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
207 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
208 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
209 static PyTypeObject *Compare_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
210 static char *Compare_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
211 "left", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
212 "ops", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
213 "comparators", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
214 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
215 static PyTypeObject *Call_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
216 static char *Call_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
217 "func", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
218 "args", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
219 "keywords", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
220 "starargs", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
221 "kwargs", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
222 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
223 static PyTypeObject *Num_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
224 static char *Num_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
225 "n", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
226 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
227 static PyTypeObject *Str_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
228 static char *Str_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
229 "s", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
230 }; |
| 40894 | 231 static PyTypeObject *Bytes_type; |
| 232 static char *Bytes_fields[]={ | |
| 233 "s", | |
| 234 }; | |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
235 static PyTypeObject *Ellipsis_type; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
236 static PyTypeObject *Attribute_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
237 static char *Attribute_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
238 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
239 "attr", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
240 "ctx", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
241 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
242 static PyTypeObject *Subscript_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
243 static char *Subscript_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
244 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
245 "slice", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
246 "ctx", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
247 }; |
|
41699
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
248 static PyTypeObject *Starred_type; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
249 static char *Starred_fields[]={ |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
250 "value", |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
251 "ctx", |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
252 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
253 static PyTypeObject *Name_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
254 static char *Name_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
255 "id", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
256 "ctx", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
257 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
258 static PyTypeObject *List_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
259 static char *List_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
260 "elts", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
261 "ctx", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
262 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
263 static PyTypeObject *Tuple_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
264 static char *Tuple_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
265 "elts", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
266 "ctx", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
267 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
268 static PyTypeObject *expr_context_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
269 static PyObject *Load_singleton, *Store_singleton, *Del_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
270 *AugLoad_singleton, *AugStore_singleton, *Param_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
271 static PyObject* ast2obj_expr_context(expr_context_ty); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
272 static PyTypeObject *Load_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
273 static PyTypeObject *Store_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
274 static PyTypeObject *Del_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
275 static PyTypeObject *AugLoad_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
276 static PyTypeObject *AugStore_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
277 static PyTypeObject *Param_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
278 static PyTypeObject *slice_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
279 static PyObject* ast2obj_slice(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
280 static PyTypeObject *Slice_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
281 static char *Slice_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
282 "lower", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
283 "upper", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
284 "step", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
285 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
286 static PyTypeObject *ExtSlice_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
287 static char *ExtSlice_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
288 "dims", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
289 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
290 static PyTypeObject *Index_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
291 static char *Index_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
292 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
293 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
294 static PyTypeObject *boolop_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
295 static PyObject *And_singleton, *Or_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
296 static PyObject* ast2obj_boolop(boolop_ty); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
297 static PyTypeObject *And_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
298 static PyTypeObject *Or_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
299 static PyTypeObject *operator_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
300 static PyObject *Add_singleton, *Sub_singleton, *Mult_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
301 *Div_singleton, *Mod_singleton, *Pow_singleton, *LShift_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
302 *RShift_singleton, *BitOr_singleton, *BitXor_singleton, *BitAnd_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
303 *FloorDiv_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
304 static PyObject* ast2obj_operator(operator_ty); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
305 static PyTypeObject *Add_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
306 static PyTypeObject *Sub_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
307 static PyTypeObject *Mult_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
308 static PyTypeObject *Div_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
309 static PyTypeObject *Mod_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
310 static PyTypeObject *Pow_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
311 static PyTypeObject *LShift_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
312 static PyTypeObject *RShift_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
313 static PyTypeObject *BitOr_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
314 static PyTypeObject *BitXor_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
315 static PyTypeObject *BitAnd_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
316 static PyTypeObject *FloorDiv_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
317 static PyTypeObject *unaryop_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
318 static PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
319 *USub_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
320 static PyObject* ast2obj_unaryop(unaryop_ty); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
321 static PyTypeObject *Invert_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
322 static PyTypeObject *Not_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
323 static PyTypeObject *UAdd_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
324 static PyTypeObject *USub_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
325 static PyTypeObject *cmpop_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
326 static PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
327 *Gt_singleton, *GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
328 *NotIn_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
329 static PyObject* ast2obj_cmpop(cmpop_ty); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
330 static PyTypeObject *Eq_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
331 static PyTypeObject *NotEq_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
332 static PyTypeObject *Lt_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
333 static PyTypeObject *LtE_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
334 static PyTypeObject *Gt_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
335 static PyTypeObject *GtE_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
336 static PyTypeObject *Is_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
337 static PyTypeObject *IsNot_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
338 static PyTypeObject *In_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
339 static PyTypeObject *NotIn_type; |
|
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
340 static PyTypeObject *comprehension_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
341 static PyObject* ast2obj_comprehension(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
342 static char *comprehension_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
343 "target", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
344 "iter", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
345 "ifs", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
346 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
347 static PyTypeObject *excepthandler_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
348 static PyObject* ast2obj_excepthandler(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
349 static char *excepthandler_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
350 "type", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
351 "name", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
352 "body", |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
353 "lineno", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
354 "col_offset", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
355 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
356 static PyTypeObject *arguments_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
357 static PyObject* ast2obj_arguments(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
358 static char *arguments_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
359 "args", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
360 "vararg", |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
361 "varargannotation", |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
362 "kwonlyargs", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
363 "kwarg", |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
364 "kwargannotation", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
365 "defaults", |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
366 "kw_defaults", |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
367 }; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
368 static PyTypeObject *arg_type; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
369 static PyObject* ast2obj_arg(void*); |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
370 static char *arg_fields[]={ |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
371 "arg", |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
372 "annotation", |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
373 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
374 static PyTypeObject *keyword_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
375 static PyObject* ast2obj_keyword(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
376 static char *keyword_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
377 "arg", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
378 "value", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
379 }; |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
380 static PyTypeObject *alias_type; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
381 static PyObject* ast2obj_alias(void*); |
|
36743
dbf9cc6c36eb
Don't pollute namespace as bad as before. All the types are static now.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36726
diff
changeset
|
382 static char *alias_fields[]={ |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
383 "name", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
384 "asname", |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
385 }; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
386 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
387 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
388 static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
389 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
390 PyObject *fnames, *result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
391 int i; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
392 if (num_fields) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
393 fnames = PyTuple_New(num_fields); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
394 if (!fnames) return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
395 } else { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
396 fnames = Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
397 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
398 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
399 for(i=0; i < num_fields; i++) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
400 PyObject *field = PyString_FromString(fields[i]); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
401 if (!field) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
402 Py_DECREF(fnames); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
403 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
404 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
405 PyTuple_SET_ITEM(fnames, i, field); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
406 } |
|
36726
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
407 result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}", |
| 36669 | 408 type, base, "_fields", fnames, "__module__", "_ast"); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
409 Py_DECREF(fnames); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
410 return (PyTypeObject*)result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
411 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
412 |
| 36669 | 413 static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) |
| 414 { | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
415 int i, result; |
| 36669 | 416 PyObject *s, *l = PyList_New(num_fields); |
| 417 if (!l) return 0; | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
418 for(i = 0; i < num_fields; i++) { |
| 36669 | 419 s = PyString_FromString(attrs[i]); |
| 420 if (!s) { | |
| 421 Py_DECREF(l); | |
| 422 return 0; | |
| 423 } | |
| 424 PyList_SET_ITEM(l, i, s); | |
| 425 } | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
426 result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
427 Py_DECREF(l); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
428 return result; |
| 36669 | 429 } |
| 430 | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
431 static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*)) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
432 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
433 int i, n = asdl_seq_LEN(seq); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
434 PyObject *result = PyList_New(n); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
435 PyObject *value; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
436 if (!result) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
437 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
438 for (i = 0; i < n; i++) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
439 value = func(asdl_seq_GET(seq, i)); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
440 if (!value) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
441 Py_DECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
442 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
443 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
444 PyList_SET_ITEM(result, i, value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
445 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
446 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
447 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
448 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
449 static PyObject* ast2obj_object(void *o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
450 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
451 if (!o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
452 o = Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
453 Py_INCREF((PyObject*)o); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
454 return (PyObject*)o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
455 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
456 #define ast2obj_identifier ast2obj_object |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
457 #define ast2obj_string ast2obj_object |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
458 |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
459 static PyObject* ast2obj_int(long b) |
| 36669 | 460 { |
| 461 return PyInt_FromLong(b); | |
| 462 } | |
| 463 | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
464 static int init_types(void) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
465 { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
466 static int initialized; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
467 if (initialized) return 1; |
| 36669 | 468 AST_type = make_type("AST", &PyBaseObject_Type, NULL, 0); |
| 469 mod_type = make_type("mod", AST_type, NULL, 0); | |
| 470 if (!mod_type) return 0; | |
| 471 if (!add_attributes(mod_type, NULL, 0)) return 0; | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
472 Module_type = make_type("Module", mod_type, Module_fields, 1); |
| 36669 | 473 if (!Module_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
474 Interactive_type = make_type("Interactive", mod_type, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
475 Interactive_fields, 1); |
| 36669 | 476 if (!Interactive_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
477 Expression_type = make_type("Expression", mod_type, Expression_fields, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
478 1); |
| 36669 | 479 if (!Expression_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
480 Suite_type = make_type("Suite", mod_type, Suite_fields, 1); |
| 36669 | 481 if (!Suite_type) return 0; |
| 482 stmt_type = make_type("stmt", AST_type, NULL, 0); | |
| 483 if (!stmt_type) return 0; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
484 if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
485 FunctionDef_type = make_type("FunctionDef", stmt_type, |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
486 FunctionDef_fields, 5); |
| 36669 | 487 if (!FunctionDef_type) return 0; |
|
41226
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
488 ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 6); |
| 36669 | 489 if (!ClassDef_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
490 Return_type = make_type("Return", stmt_type, Return_fields, 1); |
| 36669 | 491 if (!Return_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
492 Delete_type = make_type("Delete", stmt_type, Delete_fields, 1); |
| 36669 | 493 if (!Delete_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
494 Assign_type = make_type("Assign", stmt_type, Assign_fields, 2); |
| 36669 | 495 if (!Assign_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
496 AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3); |
| 36669 | 497 if (!AugAssign_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
498 For_type = make_type("For", stmt_type, For_fields, 4); |
| 36669 | 499 if (!For_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
500 While_type = make_type("While", stmt_type, While_fields, 3); |
| 36669 | 501 if (!While_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
502 If_type = make_type("If", stmt_type, If_fields, 3); |
| 36669 | 503 if (!If_type) return 0; |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
504 With_type = make_type("With", stmt_type, With_fields, 3); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
505 if (!With_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
506 Raise_type = make_type("Raise", stmt_type, Raise_fields, 3); |
| 36669 | 507 if (!Raise_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
508 TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3); |
| 36669 | 509 if (!TryExcept_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
510 TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
511 2); |
| 36669 | 512 if (!TryFinally_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
513 Assert_type = make_type("Assert", stmt_type, Assert_fields, 2); |
| 36669 | 514 if (!Assert_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
515 Import_type = make_type("Import", stmt_type, Import_fields, 1); |
| 36669 | 516 if (!Import_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
517 ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields, |
|
36712
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
518 3); |
| 36669 | 519 if (!ImportFrom_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
520 Global_type = make_type("Global", stmt_type, Global_fields, 1); |
| 36669 | 521 if (!Global_type) return 0; |
|
40965
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
522 Nonlocal_type = make_type("Nonlocal", stmt_type, Nonlocal_fields, 1); |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
523 if (!Nonlocal_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
524 Expr_type = make_type("Expr", stmt_type, Expr_fields, 1); |
| 36669 | 525 if (!Expr_type) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
526 Pass_type = make_type("Pass", stmt_type, NULL, 0); |
| 36669 | 527 if (!Pass_type) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
528 Break_type = make_type("Break", stmt_type, NULL, 0); |
| 36669 | 529 if (!Break_type) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
530 Continue_type = make_type("Continue", stmt_type, NULL, 0); |
| 36669 | 531 if (!Continue_type) return 0; |
| 532 expr_type = make_type("expr", AST_type, NULL, 0); | |
| 533 if (!expr_type) return 0; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
534 if (!add_attributes(expr_type, expr_attributes, 2)) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
535 BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2); |
| 36669 | 536 if (!BoolOp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
537 BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); |
| 36669 | 538 if (!BinOp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
539 UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); |
| 36669 | 540 if (!UnaryOp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
541 Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2); |
| 36669 | 542 if (!Lambda_type) return 0; |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
543 IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3); |
| 36669 | 544 if (!IfExp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
545 Dict_type = make_type("Dict", expr_type, Dict_fields, 2); |
| 36669 | 546 if (!Dict_type) return 0; |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
547 Set_type = make_type("Set", expr_type, Set_fields, 1); |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
548 if (!Set_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
549 ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2); |
| 36669 | 550 if (!ListComp_type) return 0; |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
551 SetComp_type = make_type("SetComp", expr_type, SetComp_fields, 2); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
552 if (!SetComp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
553 GeneratorExp_type = make_type("GeneratorExp", expr_type, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
554 GeneratorExp_fields, 2); |
| 36669 | 555 if (!GeneratorExp_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
556 Yield_type = make_type("Yield", expr_type, Yield_fields, 1); |
| 36669 | 557 if (!Yield_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
558 Compare_type = make_type("Compare", expr_type, Compare_fields, 3); |
| 36669 | 559 if (!Compare_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
560 Call_type = make_type("Call", expr_type, Call_fields, 5); |
| 36669 | 561 if (!Call_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
562 Num_type = make_type("Num", expr_type, Num_fields, 1); |
| 36669 | 563 if (!Num_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
564 Str_type = make_type("Str", expr_type, Str_fields, 1); |
| 36669 | 565 if (!Str_type) return 0; |
| 40894 | 566 Bytes_type = make_type("Bytes", expr_type, Bytes_fields, 1); |
| 567 if (!Bytes_type) return 0; | |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
568 Ellipsis_type = make_type("Ellipsis", expr_type, NULL, 0); |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
569 if (!Ellipsis_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
570 Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); |
| 36669 | 571 if (!Attribute_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
572 Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); |
| 36669 | 573 if (!Subscript_type) return 0; |
|
41699
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
574 Starred_type = make_type("Starred", expr_type, Starred_fields, 2); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
575 if (!Starred_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
576 Name_type = make_type("Name", expr_type, Name_fields, 2); |
| 36669 | 577 if (!Name_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
578 List_type = make_type("List", expr_type, List_fields, 2); |
| 36669 | 579 if (!List_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
580 Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2); |
| 36669 | 581 if (!Tuple_type) return 0; |
| 582 expr_context_type = make_type("expr_context", AST_type, NULL, 0); | |
| 583 if (!expr_context_type) return 0; | |
| 584 if (!add_attributes(expr_context_type, NULL, 0)) return 0; | |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
585 Load_type = make_type("Load", expr_context_type, NULL, 0); |
| 36669 | 586 if (!Load_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
587 Load_singleton = PyType_GenericNew(Load_type, NULL, NULL); |
| 36669 | 588 if (!Load_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
589 Store_type = make_type("Store", expr_context_type, NULL, 0); |
| 36669 | 590 if (!Store_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
591 Store_singleton = PyType_GenericNew(Store_type, NULL, NULL); |
| 36669 | 592 if (!Store_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
593 Del_type = make_type("Del", expr_context_type, NULL, 0); |
| 36669 | 594 if (!Del_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
595 Del_singleton = PyType_GenericNew(Del_type, NULL, NULL); |
| 36669 | 596 if (!Del_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
597 AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0); |
| 36669 | 598 if (!AugLoad_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
599 AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL); |
| 36669 | 600 if (!AugLoad_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
601 AugStore_type = make_type("AugStore", expr_context_type, NULL, 0); |
| 36669 | 602 if (!AugStore_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
603 AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL); |
| 36669 | 604 if (!AugStore_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
605 Param_type = make_type("Param", expr_context_type, NULL, 0); |
| 36669 | 606 if (!Param_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
607 Param_singleton = PyType_GenericNew(Param_type, NULL, NULL); |
| 36669 | 608 if (!Param_singleton) return 0; |
| 609 slice_type = make_type("slice", AST_type, NULL, 0); | |
| 610 if (!slice_type) return 0; | |
| 611 if (!add_attributes(slice_type, NULL, 0)) return 0; | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
612 Slice_type = make_type("Slice", slice_type, Slice_fields, 3); |
| 36669 | 613 if (!Slice_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
614 ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1); |
| 36669 | 615 if (!ExtSlice_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
616 Index_type = make_type("Index", slice_type, Index_fields, 1); |
| 36669 | 617 if (!Index_type) return 0; |
| 618 boolop_type = make_type("boolop", AST_type, NULL, 0); | |
| 619 if (!boolop_type) return 0; | |
| 620 if (!add_attributes(boolop_type, NULL, 0)) return 0; | |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
621 And_type = make_type("And", boolop_type, NULL, 0); |
| 36669 | 622 if (!And_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
623 And_singleton = PyType_GenericNew(And_type, NULL, NULL); |
| 36669 | 624 if (!And_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
625 Or_type = make_type("Or", boolop_type, NULL, 0); |
| 36669 | 626 if (!Or_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
627 Or_singleton = PyType_GenericNew(Or_type, NULL, NULL); |
| 36669 | 628 if (!Or_singleton) return 0; |
| 629 operator_type = make_type("operator", AST_type, NULL, 0); | |
| 630 if (!operator_type) return 0; | |
| 631 if (!add_attributes(operator_type, NULL, 0)) return 0; | |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
632 Add_type = make_type("Add", operator_type, NULL, 0); |
| 36669 | 633 if (!Add_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
634 Add_singleton = PyType_GenericNew(Add_type, NULL, NULL); |
| 36669 | 635 if (!Add_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
636 Sub_type = make_type("Sub", operator_type, NULL, 0); |
| 36669 | 637 if (!Sub_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
638 Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL); |
| 36669 | 639 if (!Sub_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
640 Mult_type = make_type("Mult", operator_type, NULL, 0); |
| 36669 | 641 if (!Mult_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
642 Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL); |
| 36669 | 643 if (!Mult_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
644 Div_type = make_type("Div", operator_type, NULL, 0); |
| 36669 | 645 if (!Div_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
646 Div_singleton = PyType_GenericNew(Div_type, NULL, NULL); |
| 36669 | 647 if (!Div_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
648 Mod_type = make_type("Mod", operator_type, NULL, 0); |
| 36669 | 649 if (!Mod_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
650 Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL); |
| 36669 | 651 if (!Mod_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
652 Pow_type = make_type("Pow", operator_type, NULL, 0); |
| 36669 | 653 if (!Pow_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
654 Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL); |
| 36669 | 655 if (!Pow_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
656 LShift_type = make_type("LShift", operator_type, NULL, 0); |
| 36669 | 657 if (!LShift_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
658 LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL); |
| 36669 | 659 if (!LShift_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
660 RShift_type = make_type("RShift", operator_type, NULL, 0); |
| 36669 | 661 if (!RShift_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
662 RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL); |
| 36669 | 663 if (!RShift_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
664 BitOr_type = make_type("BitOr", operator_type, NULL, 0); |
| 36669 | 665 if (!BitOr_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
666 BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL); |
| 36669 | 667 if (!BitOr_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
668 BitXor_type = make_type("BitXor", operator_type, NULL, 0); |
| 36669 | 669 if (!BitXor_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
670 BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL); |
| 36669 | 671 if (!BitXor_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
672 BitAnd_type = make_type("BitAnd", operator_type, NULL, 0); |
| 36669 | 673 if (!BitAnd_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
674 BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL); |
| 36669 | 675 if (!BitAnd_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
676 FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0); |
| 36669 | 677 if (!FloorDiv_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
678 FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL); |
| 36669 | 679 if (!FloorDiv_singleton) return 0; |
| 680 unaryop_type = make_type("unaryop", AST_type, NULL, 0); | |
| 681 if (!unaryop_type) return 0; | |
| 682 if (!add_attributes(unaryop_type, NULL, 0)) return 0; | |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
683 Invert_type = make_type("Invert", unaryop_type, NULL, 0); |
| 36669 | 684 if (!Invert_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
685 Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL); |
| 36669 | 686 if (!Invert_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
687 Not_type = make_type("Not", unaryop_type, NULL, 0); |
| 36669 | 688 if (!Not_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
689 Not_singleton = PyType_GenericNew(Not_type, NULL, NULL); |
| 36669 | 690 if (!Not_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
691 UAdd_type = make_type("UAdd", unaryop_type, NULL, 0); |
| 36669 | 692 if (!UAdd_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
693 UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL); |
| 36669 | 694 if (!UAdd_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
695 USub_type = make_type("USub", unaryop_type, NULL, 0); |
| 36669 | 696 if (!USub_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
697 USub_singleton = PyType_GenericNew(USub_type, NULL, NULL); |
| 36669 | 698 if (!USub_singleton) return 0; |
| 699 cmpop_type = make_type("cmpop", AST_type, NULL, 0); | |
| 700 if (!cmpop_type) return 0; | |
| 701 if (!add_attributes(cmpop_type, NULL, 0)) return 0; | |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
702 Eq_type = make_type("Eq", cmpop_type, NULL, 0); |
| 36669 | 703 if (!Eq_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
704 Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL); |
| 36669 | 705 if (!Eq_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
706 NotEq_type = make_type("NotEq", cmpop_type, NULL, 0); |
| 36669 | 707 if (!NotEq_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
708 NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL); |
| 36669 | 709 if (!NotEq_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
710 Lt_type = make_type("Lt", cmpop_type, NULL, 0); |
| 36669 | 711 if (!Lt_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
712 Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL); |
| 36669 | 713 if (!Lt_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
714 LtE_type = make_type("LtE", cmpop_type, NULL, 0); |
| 36669 | 715 if (!LtE_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
716 LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL); |
| 36669 | 717 if (!LtE_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
718 Gt_type = make_type("Gt", cmpop_type, NULL, 0); |
| 36669 | 719 if (!Gt_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
720 Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL); |
| 36669 | 721 if (!Gt_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
722 GtE_type = make_type("GtE", cmpop_type, NULL, 0); |
| 36669 | 723 if (!GtE_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
724 GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL); |
| 36669 | 725 if (!GtE_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
726 Is_type = make_type("Is", cmpop_type, NULL, 0); |
| 36669 | 727 if (!Is_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
728 Is_singleton = PyType_GenericNew(Is_type, NULL, NULL); |
| 36669 | 729 if (!Is_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
730 IsNot_type = make_type("IsNot", cmpop_type, NULL, 0); |
| 36669 | 731 if (!IsNot_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
732 IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL); |
| 36669 | 733 if (!IsNot_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
734 In_type = make_type("In", cmpop_type, NULL, 0); |
| 36669 | 735 if (!In_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
736 In_singleton = PyType_GenericNew(In_type, NULL, NULL); |
| 36669 | 737 if (!In_singleton) return 0; |
|
36664
7bfbfb2ef4e2
Stop generating empty arrays.
Martin v. Löwis <martin@v.loewis.de>
parents:
36661
diff
changeset
|
738 NotIn_type = make_type("NotIn", cmpop_type, NULL, 0); |
| 36669 | 739 if (!NotIn_type) return 0; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
740 NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL); |
| 36669 | 741 if (!NotIn_singleton) return 0; |
| 742 comprehension_type = make_type("comprehension", AST_type, | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
743 comprehension_fields, 3); |
| 36669 | 744 if (!comprehension_type) return 0; |
| 745 excepthandler_type = make_type("excepthandler", AST_type, | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
746 excepthandler_fields, 5); |
| 36669 | 747 if (!excepthandler_type) return 0; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
748 arguments_type = make_type("arguments", AST_type, arguments_fields, 8); |
| 36669 | 749 if (!arguments_type) return 0; |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
750 arg_type = make_type("arg", AST_type, arg_fields, 2); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
751 if (!arg_type) return 0; |
| 36669 | 752 keyword_type = make_type("keyword", AST_type, keyword_fields, 2); |
| 753 if (!keyword_type) return 0; | |
| 754 alias_type = make_type("alias", AST_type, alias_fields, 2); | |
| 755 if (!alias_type) return 0; | |
| 756 initialized = 1; | |
| 757 return 1; | |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
758 } |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
759 |
| 35742 | 760 mod_ty |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
761 Module(asdl_seq * body, PyArena *arena) |
| 35742 | 762 { |
| 763 mod_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
764 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
765 if (!p) |
| 35742 | 766 return NULL; |
| 767 p->kind = Module_kind; | |
| 768 p->v.Module.body = body; | |
| 769 return p; | |
| 770 } | |
| 771 | |
| 772 mod_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
773 Interactive(asdl_seq * body, PyArena *arena) |
| 35742 | 774 { |
| 775 mod_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
776 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
777 if (!p) |
| 35742 | 778 return NULL; |
| 779 p->kind = Interactive_kind; | |
| 780 p->v.Interactive.body = body; | |
| 781 return p; | |
| 782 } | |
| 783 | |
| 784 mod_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
785 Expression(expr_ty body, PyArena *arena) |
| 35742 | 786 { |
| 787 mod_ty p; | |
| 788 if (!body) { | |
| 789 PyErr_SetString(PyExc_ValueError, | |
| 790 "field body is required for Expression"); | |
| 791 return NULL; | |
| 792 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
793 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
794 if (!p) |
| 35742 | 795 return NULL; |
| 796 p->kind = Expression_kind; | |
| 797 p->v.Expression.body = body; | |
| 798 return p; | |
| 799 } | |
| 800 | |
| 801 mod_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
802 Suite(asdl_seq * body, PyArena *arena) |
| 35742 | 803 { |
| 804 mod_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
805 p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
806 if (!p) |
| 35742 | 807 return NULL; |
| 808 p->kind = Suite_kind; | |
| 809 p->v.Suite.body = body; | |
| 810 return p; | |
| 811 } | |
| 812 | |
| 813 stmt_ty | |
| 814 FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * | |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
815 decorators, expr_ty returns, int lineno, int col_offset, PyArena |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
816 *arena) |
| 35742 | 817 { |
| 818 stmt_ty p; | |
| 819 if (!name) { | |
| 820 PyErr_SetString(PyExc_ValueError, | |
| 821 "field name is required for FunctionDef"); | |
| 822 return NULL; | |
| 823 } | |
| 824 if (!args) { | |
| 825 PyErr_SetString(PyExc_ValueError, | |
| 826 "field args is required for FunctionDef"); | |
| 827 return NULL; | |
| 828 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
829 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
830 if (!p) |
| 35742 | 831 return NULL; |
| 832 p->kind = FunctionDef_kind; | |
| 833 p->v.FunctionDef.name = name; | |
| 834 p->v.FunctionDef.args = args; | |
| 835 p->v.FunctionDef.body = body; | |
| 836 p->v.FunctionDef.decorators = decorators; | |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
837 p->v.FunctionDef.returns = returns; |
| 35742 | 838 p->lineno = lineno; |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
839 p->col_offset = col_offset; |
| 35742 | 840 return p; |
| 841 } | |
| 842 | |
| 843 stmt_ty | |
|
41226
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
844 ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, expr_ty |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
845 starargs, expr_ty kwargs, asdl_seq * body, int lineno, int col_offset, |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
846 PyArena *arena) |
| 35742 | 847 { |
| 848 stmt_ty p; | |
| 849 if (!name) { | |
| 850 PyErr_SetString(PyExc_ValueError, | |
| 851 "field name is required for ClassDef"); | |
| 852 return NULL; | |
| 853 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
854 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
855 if (!p) |
| 35742 | 856 return NULL; |
| 857 p->kind = ClassDef_kind; | |
| 858 p->v.ClassDef.name = name; | |
| 859 p->v.ClassDef.bases = bases; | |
|
41226
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
860 p->v.ClassDef.keywords = keywords; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
861 p->v.ClassDef.starargs = starargs; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
862 p->v.ClassDef.kwargs = kwargs; |
| 35742 | 863 p->v.ClassDef.body = body; |
| 864 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
865 p->col_offset = col_offset; |
| 35742 | 866 return p; |
| 867 } | |
| 868 | |
| 869 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
870 Return(expr_ty value, int lineno, int col_offset, PyArena *arena) |
| 35742 | 871 { |
| 872 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
873 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
874 if (!p) |
| 35742 | 875 return NULL; |
| 876 p->kind = Return_kind; | |
| 877 p->v.Return.value = value; | |
| 878 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
879 p->col_offset = col_offset; |
| 35742 | 880 return p; |
| 881 } | |
| 882 | |
| 883 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
884 Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena) |
| 35742 | 885 { |
| 886 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
887 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
888 if (!p) |
| 35742 | 889 return NULL; |
| 890 p->kind = Delete_kind; | |
| 891 p->v.Delete.targets = targets; | |
| 892 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
893 p->col_offset = col_offset; |
| 35742 | 894 return p; |
| 895 } | |
| 896 | |
| 897 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
898 Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
899 *arena) |
| 35742 | 900 { |
| 901 stmt_ty p; | |
| 902 if (!value) { | |
| 903 PyErr_SetString(PyExc_ValueError, | |
| 904 "field value is required for Assign"); | |
| 905 return NULL; | |
| 906 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
907 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
908 if (!p) |
| 35742 | 909 return NULL; |
| 910 p->kind = Assign_kind; | |
| 911 p->v.Assign.targets = targets; | |
| 912 p->v.Assign.value = value; | |
| 913 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
914 p->col_offset = col_offset; |
| 35742 | 915 return p; |
| 916 } | |
| 917 | |
| 918 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
919 AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
920 col_offset, PyArena *arena) |
| 35742 | 921 { |
| 922 stmt_ty p; | |
| 923 if (!target) { | |
| 924 PyErr_SetString(PyExc_ValueError, | |
| 925 "field target is required for AugAssign"); | |
| 926 return NULL; | |
| 927 } | |
| 928 if (!op) { | |
| 929 PyErr_SetString(PyExc_ValueError, | |
| 930 "field op is required for AugAssign"); | |
| 931 return NULL; | |
| 932 } | |
| 933 if (!value) { | |
| 934 PyErr_SetString(PyExc_ValueError, | |
| 935 "field value is required for AugAssign"); | |
| 936 return NULL; | |
| 937 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
938 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
939 if (!p) |
| 35742 | 940 return NULL; |
| 941 p->kind = AugAssign_kind; | |
| 942 p->v.AugAssign.target = target; | |
| 943 p->v.AugAssign.op = op; | |
| 944 p->v.AugAssign.value = value; | |
| 945 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
946 p->col_offset = col_offset; |
| 35742 | 947 return p; |
| 948 } | |
| 949 | |
| 950 stmt_ty | |
| 951 For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
952 lineno, int col_offset, PyArena *arena) |
| 35742 | 953 { |
| 954 stmt_ty p; | |
| 955 if (!target) { | |
| 956 PyErr_SetString(PyExc_ValueError, | |
| 957 "field target is required for For"); | |
| 958 return NULL; | |
| 959 } | |
| 960 if (!iter) { | |
| 961 PyErr_SetString(PyExc_ValueError, | |
| 962 "field iter is required for For"); | |
| 963 return NULL; | |
| 964 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
965 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
966 if (!p) |
| 35742 | 967 return NULL; |
| 968 p->kind = For_kind; | |
| 969 p->v.For.target = target; | |
| 970 p->v.For.iter = iter; | |
| 971 p->v.For.body = body; | |
| 972 p->v.For.orelse = orelse; | |
| 973 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
974 p->col_offset = col_offset; |
| 35742 | 975 return p; |
| 976 } | |
| 977 | |
| 978 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
979 While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
980 col_offset, PyArena *arena) |
| 35742 | 981 { |
| 982 stmt_ty p; | |
| 983 if (!test) { | |
| 984 PyErr_SetString(PyExc_ValueError, | |
| 985 "field test is required for While"); | |
| 986 return NULL; | |
| 987 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
988 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
989 if (!p) |
| 35742 | 990 return NULL; |
| 991 p->kind = While_kind; | |
| 992 p->v.While.test = test; | |
| 993 p->v.While.body = body; | |
| 994 p->v.While.orelse = orelse; | |
| 995 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
996 p->col_offset = col_offset; |
| 35742 | 997 return p; |
| 998 } | |
| 999 | |
| 1000 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1001 If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1002 col_offset, PyArena *arena) |
| 35742 | 1003 { |
| 1004 stmt_ty p; | |
| 1005 if (!test) { | |
| 1006 PyErr_SetString(PyExc_ValueError, | |
| 1007 "field test is required for If"); | |
| 1008 return NULL; | |
| 1009 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1010 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1011 if (!p) |
| 35742 | 1012 return NULL; |
| 1013 p->kind = If_kind; | |
| 1014 p->v.If.test = test; | |
| 1015 p->v.If.body = body; | |
| 1016 p->v.If.orelse = orelse; | |
| 1017 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1018 p->col_offset = col_offset; |
| 35742 | 1019 return p; |
| 1020 } | |
| 1021 | |
| 1022 stmt_ty | |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1023 With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno, |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1024 int col_offset, PyArena *arena) |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1025 { |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1026 stmt_ty p; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1027 if (!context_expr) { |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1028 PyErr_SetString(PyExc_ValueError, |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1029 "field context_expr is required for With"); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1030 return NULL; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1031 } |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1032 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1033 if (!p) |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1034 return NULL; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1035 p->kind = With_kind; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1036 p->v.With.context_expr = context_expr; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1037 p->v.With.optional_vars = optional_vars; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1038 p->v.With.body = body; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1039 p->lineno = lineno; |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1040 p->col_offset = col_offset; |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1041 return p; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1042 } |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1043 |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
1044 stmt_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1045 Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1046 PyArena *arena) |
| 35742 | 1047 { |
| 1048 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1049 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1050 if (!p) |
| 35742 | 1051 return NULL; |
| 1052 p->kind = Raise_kind; | |
| 1053 p->v.Raise.type = type; | |
| 1054 p->v.Raise.inst = inst; | |
| 1055 p->v.Raise.tback = tback; | |
| 1056 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1057 p->col_offset = col_offset; |
| 35742 | 1058 return p; |
| 1059 } | |
| 1060 | |
| 1061 stmt_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1062 TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1063 int col_offset, PyArena *arena) |
| 35742 | 1064 { |
| 1065 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1066 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1067 if (!p) |
| 35742 | 1068 return NULL; |
| 1069 p->kind = TryExcept_kind; | |
| 1070 p->v.TryExcept.body = body; | |
| 1071 p->v.TryExcept.handlers = handlers; | |
| 1072 p->v.TryExcept.orelse = orelse; | |
| 1073 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1074 p->col_offset = col_offset; |
| 35742 | 1075 return p; |
| 1076 } | |
| 1077 | |
| 1078 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1079 TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1080 PyArena *arena) |
| 35742 | 1081 { |
| 1082 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1083 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1084 if (!p) |
| 35742 | 1085 return NULL; |
| 1086 p->kind = TryFinally_kind; | |
| 1087 p->v.TryFinally.body = body; | |
| 1088 p->v.TryFinally.finalbody = finalbody; | |
| 1089 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1090 p->col_offset = col_offset; |
| 35742 | 1091 return p; |
| 1092 } | |
| 1093 | |
| 1094 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1095 Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1096 { |
| 1097 stmt_ty p; | |
| 1098 if (!test) { | |
| 1099 PyErr_SetString(PyExc_ValueError, | |
| 1100 "field test is required for Assert"); | |
| 1101 return NULL; | |
| 1102 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1103 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1104 if (!p) |
| 35742 | 1105 return NULL; |
| 1106 p->kind = Assert_kind; | |
| 1107 p->v.Assert.test = test; | |
| 1108 p->v.Assert.msg = msg; | |
| 1109 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1110 p->col_offset = col_offset; |
| 35742 | 1111 return p; |
| 1112 } | |
| 1113 | |
| 1114 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1115 Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1116 { |
| 1117 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1118 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1119 if (!p) |
| 35742 | 1120 return NULL; |
| 1121 p->kind = Import_kind; | |
| 1122 p->v.Import.names = names; | |
| 1123 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1124 p->col_offset = col_offset; |
| 35742 | 1125 return p; |
| 1126 } | |
| 1127 | |
| 1128 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1129 ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1130 col_offset, PyArena *arena) |
| 35742 | 1131 { |
| 1132 stmt_ty p; | |
| 1133 if (!module) { | |
| 1134 PyErr_SetString(PyExc_ValueError, | |
| 1135 "field module is required for ImportFrom"); | |
| 1136 return NULL; | |
| 1137 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1138 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1139 if (!p) |
| 35742 | 1140 return NULL; |
| 1141 p->kind = ImportFrom_kind; | |
| 1142 p->v.ImportFrom.module = module; | |
| 1143 p->v.ImportFrom.names = names; | |
|
36712
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
1144 p->v.ImportFrom.level = level; |
| 35742 | 1145 p->lineno = lineno; |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1146 p->col_offset = col_offset; |
| 35742 | 1147 return p; |
| 1148 } | |
| 1149 | |
| 1150 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1151 Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1152 { |
| 1153 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1154 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1155 if (!p) |
| 35742 | 1156 return NULL; |
| 1157 p->kind = Global_kind; | |
| 1158 p->v.Global.names = names; | |
| 1159 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1160 p->col_offset = col_offset; |
| 35742 | 1161 return p; |
| 1162 } | |
| 1163 | |
| 1164 stmt_ty | |
|
40965
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1165 Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena *arena) |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1166 { |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1167 stmt_ty p; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1168 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1169 if (!p) |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1170 return NULL; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1171 p->kind = Nonlocal_kind; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1172 p->v.Nonlocal.names = names; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1173 p->lineno = lineno; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1174 p->col_offset = col_offset; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1175 return p; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1176 } |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1177 |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
1178 stmt_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1179 Expr(expr_ty value, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1180 { |
| 1181 stmt_ty p; | |
| 1182 if (!value) { | |
| 1183 PyErr_SetString(PyExc_ValueError, | |
| 1184 "field value is required for Expr"); | |
| 1185 return NULL; | |
| 1186 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1187 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1188 if (!p) |
| 35742 | 1189 return NULL; |
| 1190 p->kind = Expr_kind; | |
| 1191 p->v.Expr.value = value; | |
| 1192 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1193 p->col_offset = col_offset; |
| 35742 | 1194 return p; |
| 1195 } | |
| 1196 | |
| 1197 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1198 Pass(int lineno, int col_offset, PyArena *arena) |
| 35742 | 1199 { |
| 1200 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1201 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1202 if (!p) |
| 35742 | 1203 return NULL; |
| 1204 p->kind = Pass_kind; | |
| 1205 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1206 p->col_offset = col_offset; |
| 35742 | 1207 return p; |
| 1208 } | |
| 1209 | |
| 1210 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1211 Break(int lineno, int col_offset, PyArena *arena) |
| 35742 | 1212 { |
| 1213 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1214 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1215 if (!p) |
| 35742 | 1216 return NULL; |
| 1217 p->kind = Break_kind; | |
| 1218 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1219 p->col_offset = col_offset; |
| 35742 | 1220 return p; |
| 1221 } | |
| 1222 | |
| 1223 stmt_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1224 Continue(int lineno, int col_offset, PyArena *arena) |
| 35742 | 1225 { |
| 1226 stmt_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1227 p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1228 if (!p) |
| 35742 | 1229 return NULL; |
| 1230 p->kind = Continue_kind; | |
| 1231 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1232 p->col_offset = col_offset; |
| 35742 | 1233 return p; |
| 1234 } | |
| 1235 | |
| 1236 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1237 BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1238 *arena) |
| 35742 | 1239 { |
| 1240 expr_ty p; | |
| 1241 if (!op) { | |
| 1242 PyErr_SetString(PyExc_ValueError, | |
| 1243 "field op is required for BoolOp"); | |
| 1244 return NULL; | |
| 1245 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1246 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1247 if (!p) |
| 35742 | 1248 return NULL; |
| 1249 p->kind = BoolOp_kind; | |
| 1250 p->v.BoolOp.op = op; | |
| 1251 p->v.BoolOp.values = values; | |
| 1252 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1253 p->col_offset = col_offset; |
| 35742 | 1254 return p; |
| 1255 } | |
| 1256 | |
| 1257 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1258 BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1259 PyArena *arena) |
| 35742 | 1260 { |
| 1261 expr_ty p; | |
| 1262 if (!left) { | |
| 1263 PyErr_SetString(PyExc_ValueError, | |
| 1264 "field left is required for BinOp"); | |
| 1265 return NULL; | |
| 1266 } | |
| 1267 if (!op) { | |
| 1268 PyErr_SetString(PyExc_ValueError, | |
| 1269 "field op is required for BinOp"); | |
| 1270 return NULL; | |
| 1271 } | |
| 1272 if (!right) { | |
| 1273 PyErr_SetString(PyExc_ValueError, | |
| 1274 "field right is required for BinOp"); | |
| 1275 return NULL; | |
| 1276 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1277 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1278 if (!p) |
| 35742 | 1279 return NULL; |
| 1280 p->kind = BinOp_kind; | |
| 1281 p->v.BinOp.left = left; | |
| 1282 p->v.BinOp.op = op; | |
| 1283 p->v.BinOp.right = right; | |
| 1284 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1285 p->col_offset = col_offset; |
| 35742 | 1286 return p; |
| 1287 } | |
| 1288 | |
| 1289 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1290 UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1291 *arena) |
| 35742 | 1292 { |
| 1293 expr_ty p; | |
| 1294 if (!op) { | |
| 1295 PyErr_SetString(PyExc_ValueError, | |
| 1296 "field op is required for UnaryOp"); | |
| 1297 return NULL; | |
| 1298 } | |
| 1299 if (!operand) { | |
| 1300 PyErr_SetString(PyExc_ValueError, | |
| 1301 "field operand is required for UnaryOp"); | |
| 1302 return NULL; | |
| 1303 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1304 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1305 if (!p) |
| 35742 | 1306 return NULL; |
| 1307 p->kind = UnaryOp_kind; | |
| 1308 p->v.UnaryOp.op = op; | |
| 1309 p->v.UnaryOp.operand = operand; | |
| 1310 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1311 p->col_offset = col_offset; |
| 35742 | 1312 return p; |
| 1313 } | |
| 1314 | |
| 1315 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1316 Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1317 *arena) |
| 35742 | 1318 { |
| 1319 expr_ty p; | |
| 1320 if (!args) { | |
| 1321 PyErr_SetString(PyExc_ValueError, | |
| 1322 "field args is required for Lambda"); | |
| 1323 return NULL; | |
| 1324 } | |
| 1325 if (!body) { | |
| 1326 PyErr_SetString(PyExc_ValueError, | |
| 1327 "field body is required for Lambda"); | |
| 1328 return NULL; | |
| 1329 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1330 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1331 if (!p) |
| 35742 | 1332 return NULL; |
| 1333 p->kind = Lambda_kind; | |
| 1334 p->v.Lambda.args = args; | |
| 1335 p->v.Lambda.body = body; | |
| 1336 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1337 p->col_offset = col_offset; |
| 35742 | 1338 return p; |
| 1339 } | |
| 1340 | |
| 1341 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1342 IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1343 PyArena *arena) |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1344 { |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1345 expr_ty p; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1346 if (!test) { |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1347 PyErr_SetString(PyExc_ValueError, |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1348 "field test is required for IfExp"); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1349 return NULL; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1350 } |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1351 if (!body) { |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1352 PyErr_SetString(PyExc_ValueError, |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1353 "field body is required for IfExp"); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1354 return NULL; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1355 } |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1356 if (!orelse) { |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1357 PyErr_SetString(PyExc_ValueError, |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1358 "field orelse is required for IfExp"); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1359 return NULL; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1360 } |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1361 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1362 if (!p) |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1363 return NULL; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1364 p->kind = IfExp_kind; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1365 p->v.IfExp.test = test; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1366 p->v.IfExp.body = body; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1367 p->v.IfExp.orelse = orelse; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1368 p->lineno = lineno; |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1369 p->col_offset = col_offset; |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1370 return p; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1371 } |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1372 |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
1373 expr_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1374 Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1375 *arena) |
| 35742 | 1376 { |
| 1377 expr_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1378 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1379 if (!p) |
| 35742 | 1380 return NULL; |
| 1381 p->kind = Dict_kind; | |
| 1382 p->v.Dict.keys = keys; | |
| 1383 p->v.Dict.values = values; | |
| 1384 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1385 p->col_offset = col_offset; |
| 35742 | 1386 return p; |
| 1387 } | |
| 1388 | |
| 1389 expr_ty | |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1390 Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena) |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1391 { |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1392 expr_ty p; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1393 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1394 if (!p) |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1395 return NULL; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1396 p->kind = Set_kind; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1397 p->v.Set.elts = elts; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1398 p->lineno = lineno; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1399 p->col_offset = col_offset; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1400 return p; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1401 } |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1402 |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
1403 expr_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1404 ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1405 PyArena *arena) |
| 35742 | 1406 { |
| 1407 expr_ty p; | |
| 1408 if (!elt) { | |
| 1409 PyErr_SetString(PyExc_ValueError, | |
| 1410 "field elt is required for ListComp"); | |
| 1411 return NULL; | |
| 1412 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1413 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1414 if (!p) |
| 35742 | 1415 return NULL; |
| 1416 p->kind = ListComp_kind; | |
| 1417 p->v.ListComp.elt = elt; | |
| 1418 p->v.ListComp.generators = generators; | |
| 1419 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1420 p->col_offset = col_offset; |
| 35742 | 1421 return p; |
| 1422 } | |
| 1423 | |
| 1424 expr_ty | |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1425 SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1426 *arena) |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1427 { |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1428 expr_ty p; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1429 if (!elt) { |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1430 PyErr_SetString(PyExc_ValueError, |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1431 "field elt is required for SetComp"); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1432 return NULL; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1433 } |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1434 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1435 if (!p) |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1436 return NULL; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1437 p->kind = SetComp_kind; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1438 p->v.SetComp.elt = elt; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1439 p->v.SetComp.generators = generators; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1440 p->lineno = lineno; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1441 p->col_offset = col_offset; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1442 return p; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1443 } |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1444 |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
1445 expr_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1446 GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1447 PyArena *arena) |
| 35742 | 1448 { |
| 1449 expr_ty p; | |
| 1450 if (!elt) { | |
| 1451 PyErr_SetString(PyExc_ValueError, | |
| 1452 "field elt is required for GeneratorExp"); | |
| 1453 return NULL; | |
| 1454 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1455 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1456 if (!p) |
| 35742 | 1457 return NULL; |
| 1458 p->kind = GeneratorExp_kind; | |
| 1459 p->v.GeneratorExp.elt = elt; | |
| 1460 p->v.GeneratorExp.generators = generators; | |
| 1461 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1462 p->col_offset = col_offset; |
| 35742 | 1463 return p; |
| 1464 } | |
| 1465 | |
| 1466 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1467 Yield(expr_ty value, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1468 { |
| 1469 expr_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1470 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1471 if (!p) |
| 35742 | 1472 return NULL; |
| 1473 p->kind = Yield_kind; | |
| 1474 p->v.Yield.value = value; | |
| 1475 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1476 p->col_offset = col_offset; |
| 35742 | 1477 return p; |
| 1478 } | |
| 1479 | |
| 1480 expr_ty | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
1481 Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
1482 int col_offset, PyArena *arena) |
| 35742 | 1483 { |
| 1484 expr_ty p; | |
| 1485 if (!left) { | |
| 1486 PyErr_SetString(PyExc_ValueError, | |
| 1487 "field left is required for Compare"); | |
| 1488 return NULL; | |
| 1489 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1490 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1491 if (!p) |
| 35742 | 1492 return NULL; |
| 1493 p->kind = Compare_kind; | |
| 1494 p->v.Compare.left = left; | |
| 1495 p->v.Compare.ops = ops; | |
| 1496 p->v.Compare.comparators = comparators; | |
| 1497 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1498 p->col_offset = col_offset; |
| 35742 | 1499 return p; |
| 1500 } | |
| 1501 | |
| 1502 expr_ty | |
| 1503 Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1504 expr_ty kwargs, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1505 { |
| 1506 expr_ty p; | |
| 1507 if (!func) { | |
| 1508 PyErr_SetString(PyExc_ValueError, | |
| 1509 "field func is required for Call"); | |
| 1510 return NULL; | |
| 1511 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1512 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1513 if (!p) |
| 35742 | 1514 return NULL; |
| 1515 p->kind = Call_kind; | |
| 1516 p->v.Call.func = func; | |
| 1517 p->v.Call.args = args; | |
| 1518 p->v.Call.keywords = keywords; | |
| 1519 p->v.Call.starargs = starargs; | |
| 1520 p->v.Call.kwargs = kwargs; | |
| 1521 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1522 p->col_offset = col_offset; |
| 35742 | 1523 return p; |
| 1524 } | |
| 1525 | |
| 1526 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1527 Num(object n, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1528 { |
| 1529 expr_ty p; | |
| 1530 if (!n) { | |
| 1531 PyErr_SetString(PyExc_ValueError, | |
| 1532 "field n is required for Num"); | |
| 1533 return NULL; | |
| 1534 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1535 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1536 if (!p) |
| 35742 | 1537 return NULL; |
| 1538 p->kind = Num_kind; | |
| 1539 p->v.Num.n = n; | |
| 1540 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1541 p->col_offset = col_offset; |
| 35742 | 1542 return p; |
| 1543 } | |
| 1544 | |
| 1545 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1546 Str(string s, int lineno, int col_offset, PyArena *arena) |
| 35742 | 1547 { |
| 1548 expr_ty p; | |
| 1549 if (!s) { | |
| 1550 PyErr_SetString(PyExc_ValueError, | |
| 1551 "field s is required for Str"); | |
| 1552 return NULL; | |
| 1553 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1554 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1555 if (!p) |
| 35742 | 1556 return NULL; |
| 1557 p->kind = Str_kind; | |
| 1558 p->v.Str.s = s; | |
| 1559 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1560 p->col_offset = col_offset; |
| 35742 | 1561 return p; |
| 1562 } | |
| 1563 | |
| 1564 expr_ty | |
| 40894 | 1565 Bytes(string s, int lineno, int col_offset, PyArena *arena) |
| 1566 { | |
| 1567 expr_ty p; | |
| 1568 if (!s) { | |
| 1569 PyErr_SetString(PyExc_ValueError, | |
| 1570 "field s is required for Bytes"); | |
| 1571 return NULL; | |
| 1572 } | |
| 1573 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); | |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1574 if (!p) |
| 40894 | 1575 return NULL; |
| 1576 p->kind = Bytes_kind; | |
| 1577 p->v.Bytes.s = s; | |
| 1578 p->lineno = lineno; | |
| 1579 p->col_offset = col_offset; | |
| 1580 return p; | |
| 1581 } | |
| 1582 | |
| 1583 expr_ty | |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1584 Ellipsis(int lineno, int col_offset, PyArena *arena) |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1585 { |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1586 expr_ty p; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1587 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1588 if (!p) |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1589 return NULL; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1590 p->kind = Ellipsis_kind; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1591 p->lineno = lineno; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1592 p->col_offset = col_offset; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1593 return p; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1594 } |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1595 |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
1596 expr_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1597 Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1598 col_offset, PyArena *arena) |
| 35742 | 1599 { |
| 1600 expr_ty p; | |
| 1601 if (!value) { | |
| 1602 PyErr_SetString(PyExc_ValueError, | |
| 1603 "field value is required for Attribute"); | |
| 1604 return NULL; | |
| 1605 } | |
| 1606 if (!attr) { | |
| 1607 PyErr_SetString(PyExc_ValueError, | |
| 1608 "field attr is required for Attribute"); | |
| 1609 return NULL; | |
| 1610 } | |
| 1611 if (!ctx) { | |
| 1612 PyErr_SetString(PyExc_ValueError, | |
| 1613 "field ctx is required for Attribute"); | |
| 1614 return NULL; | |
| 1615 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1616 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1617 if (!p) |
| 35742 | 1618 return NULL; |
| 1619 p->kind = Attribute_kind; | |
| 1620 p->v.Attribute.value = value; | |
| 1621 p->v.Attribute.attr = attr; | |
| 1622 p->v.Attribute.ctx = ctx; | |
| 1623 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1624 p->col_offset = col_offset; |
| 35742 | 1625 return p; |
| 1626 } | |
| 1627 | |
| 1628 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1629 Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1630 col_offset, PyArena *arena) |
| 35742 | 1631 { |
| 1632 expr_ty p; | |
| 1633 if (!value) { | |
| 1634 PyErr_SetString(PyExc_ValueError, | |
| 1635 "field value is required for Subscript"); | |
| 1636 return NULL; | |
| 1637 } | |
| 1638 if (!slice) { | |
| 1639 PyErr_SetString(PyExc_ValueError, | |
| 1640 "field slice is required for Subscript"); | |
| 1641 return NULL; | |
| 1642 } | |
| 1643 if (!ctx) { | |
| 1644 PyErr_SetString(PyExc_ValueError, | |
| 1645 "field ctx is required for Subscript"); | |
| 1646 return NULL; | |
| 1647 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1648 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1649 if (!p) |
| 35742 | 1650 return NULL; |
| 1651 p->kind = Subscript_kind; | |
| 1652 p->v.Subscript.value = value; | |
| 1653 p->v.Subscript.slice = slice; | |
| 1654 p->v.Subscript.ctx = ctx; | |
| 1655 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1656 p->col_offset = col_offset; |
| 35742 | 1657 return p; |
| 1658 } | |
| 1659 | |
| 1660 expr_ty | |
|
41699
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1661 Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, PyArena |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1662 *arena) |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1663 { |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1664 expr_ty p; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1665 if (!value) { |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1666 PyErr_SetString(PyExc_ValueError, |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1667 "field value is required for Starred"); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1668 return NULL; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1669 } |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1670 if (!ctx) { |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1671 PyErr_SetString(PyExc_ValueError, |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1672 "field ctx is required for Starred"); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1673 return NULL; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1674 } |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1675 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1676 if (!p) |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1677 return NULL; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1678 p->kind = Starred_kind; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1679 p->v.Starred.value = value; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1680 p->v.Starred.ctx = ctx; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1681 p->lineno = lineno; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1682 p->col_offset = col_offset; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1683 return p; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1684 } |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1685 |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
1686 expr_ty |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1687 Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1688 *arena) |
| 35742 | 1689 { |
| 1690 expr_ty p; | |
| 1691 if (!id) { | |
| 1692 PyErr_SetString(PyExc_ValueError, | |
| 1693 "field id is required for Name"); | |
| 1694 return NULL; | |
| 1695 } | |
| 1696 if (!ctx) { | |
| 1697 PyErr_SetString(PyExc_ValueError, | |
| 1698 "field ctx is required for Name"); | |
| 1699 return NULL; | |
| 1700 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1701 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1702 if (!p) |
| 35742 | 1703 return NULL; |
| 1704 p->kind = Name_kind; | |
| 1705 p->v.Name.id = id; | |
| 1706 p->v.Name.ctx = ctx; | |
| 1707 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1708 p->col_offset = col_offset; |
| 35742 | 1709 return p; |
| 1710 } | |
| 1711 | |
| 1712 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1713 List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1714 *arena) |
| 35742 | 1715 { |
| 1716 expr_ty p; | |
| 1717 if (!ctx) { | |
| 1718 PyErr_SetString(PyExc_ValueError, | |
| 1719 "field ctx is required for List"); | |
| 1720 return NULL; | |
| 1721 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1722 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1723 if (!p) |
| 35742 | 1724 return NULL; |
| 1725 p->kind = List_kind; | |
| 1726 p->v.List.elts = elts; | |
| 1727 p->v.List.ctx = ctx; | |
| 1728 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1729 p->col_offset = col_offset; |
| 35742 | 1730 return p; |
| 1731 } | |
| 1732 | |
| 1733 expr_ty | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1734 Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1735 *arena) |
| 35742 | 1736 { |
| 1737 expr_ty p; | |
| 1738 if (!ctx) { | |
| 1739 PyErr_SetString(PyExc_ValueError, | |
| 1740 "field ctx is required for Tuple"); | |
| 1741 return NULL; | |
| 1742 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1743 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1744 if (!p) |
| 35742 | 1745 return NULL; |
| 1746 p->kind = Tuple_kind; | |
| 1747 p->v.Tuple.elts = elts; | |
| 1748 p->v.Tuple.ctx = ctx; | |
| 1749 p->lineno = lineno; | |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
1750 p->col_offset = col_offset; |
| 35742 | 1751 return p; |
| 1752 } | |
| 1753 | |
| 1754 slice_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1755 Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena) |
| 35742 | 1756 { |
| 1757 slice_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1758 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1759 if (!p) |
| 35742 | 1760 return NULL; |
| 1761 p->kind = Slice_kind; | |
| 1762 p->v.Slice.lower = lower; | |
| 1763 p->v.Slice.upper = upper; | |
| 1764 p->v.Slice.step = step; | |
| 1765 return p; | |
| 1766 } | |
| 1767 | |
| 1768 slice_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1769 ExtSlice(asdl_seq * dims, PyArena *arena) |
| 35742 | 1770 { |
| 1771 slice_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1772 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1773 if (!p) |
| 35742 | 1774 return NULL; |
| 1775 p->kind = ExtSlice_kind; | |
| 1776 p->v.ExtSlice.dims = dims; | |
| 1777 return p; | |
| 1778 } | |
| 1779 | |
| 1780 slice_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1781 Index(expr_ty value, PyArena *arena) |
| 35742 | 1782 { |
| 1783 slice_ty p; | |
| 1784 if (!value) { | |
| 1785 PyErr_SetString(PyExc_ValueError, | |
| 1786 "field value is required for Index"); | |
| 1787 return NULL; | |
| 1788 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1789 p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1790 if (!p) |
| 35742 | 1791 return NULL; |
| 1792 p->kind = Index_kind; | |
| 1793 p->v.Index.value = value; | |
| 1794 return p; | |
| 1795 } | |
| 1796 | |
| 1797 comprehension_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1798 comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena) |
| 35742 | 1799 { |
| 1800 comprehension_ty p; | |
| 1801 if (!target) { | |
| 1802 PyErr_SetString(PyExc_ValueError, | |
| 1803 "field target is required for comprehension"); | |
| 1804 return NULL; | |
| 1805 } | |
| 1806 if (!iter) { | |
| 1807 PyErr_SetString(PyExc_ValueError, | |
| 1808 "field iter is required for comprehension"); | |
| 1809 return NULL; | |
| 1810 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1811 p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1812 if (!p) |
| 35742 | 1813 return NULL; |
| 1814 p->target = target; | |
| 1815 p->iter = iter; | |
| 1816 p->ifs = ifs; | |
| 1817 return p; | |
| 1818 } | |
| 1819 | |
| 1820 excepthandler_ty | |
|
40588
4bab65fcca8e
Some more changes related to the new except syntax and semantics,
Guido van Rossum <guido@python.org>
parents:
40563
diff
changeset
|
1821 excepthandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
1822 col_offset, PyArena *arena) |
| 35742 | 1823 { |
| 1824 excepthandler_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1825 p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1826 if (!p) |
| 35742 | 1827 return NULL; |
| 1828 p->type = type; | |
| 1829 p->name = name; | |
| 1830 p->body = body; | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
1831 p->lineno = lineno; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
1832 p->col_offset = col_offset; |
| 35742 | 1833 return p; |
| 1834 } | |
| 1835 | |
| 1836 arguments_ty | |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1837 arguments(asdl_seq * args, identifier vararg, expr_ty varargannotation, |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1838 asdl_seq * kwonlyargs, identifier kwarg, expr_ty kwargannotation, |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1839 asdl_seq * defaults, asdl_seq * kw_defaults, PyArena *arena) |
| 35742 | 1840 { |
| 1841 arguments_ty p; | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1842 p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1843 if (!p) |
| 35742 | 1844 return NULL; |
| 1845 p->args = args; | |
| 1846 p->vararg = vararg; | |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1847 p->varargannotation = varargannotation; |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
1848 p->kwonlyargs = kwonlyargs; |
| 35742 | 1849 p->kwarg = kwarg; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1850 p->kwargannotation = kwargannotation; |
| 35742 | 1851 p->defaults = defaults; |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
1852 p->kw_defaults = kw_defaults; |
| 35742 | 1853 return p; |
| 1854 } | |
| 1855 | |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1856 arg_ty |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
1857 arg(identifier arg, expr_ty annotation, PyArena *arena) |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1858 { |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1859 arg_ty p; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1860 if (!arg) { |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1861 PyErr_SetString(PyExc_ValueError, |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
1862 "field arg is required for arg"); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1863 return NULL; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1864 } |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1865 p = (arg_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1866 if (!p) |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1867 return NULL; |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
1868 p->arg = arg; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
1869 p->annotation = annotation; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1870 return p; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1871 } |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
1872 |
| 35742 | 1873 keyword_ty |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1874 keyword(identifier arg, expr_ty value, PyArena *arena) |
| 35742 | 1875 { |
| 1876 keyword_ty p; | |
| 1877 if (!arg) { | |
| 1878 PyErr_SetString(PyExc_ValueError, | |
| 1879 "field arg is required for keyword"); | |
| 1880 return NULL; | |
| 1881 } | |
| 1882 if (!value) { | |
| 1883 PyErr_SetString(PyExc_ValueError, | |
| 1884 "field value is required for keyword"); | |
| 1885 return NULL; | |
| 1886 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1887 p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1888 if (!p) |
| 35742 | 1889 return NULL; |
| 1890 p->arg = arg; | |
| 1891 p->value = value; | |
| 1892 return p; | |
| 1893 } | |
| 1894 | |
| 1895 alias_ty | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1896 alias(identifier name, identifier asname, PyArena *arena) |
| 35742 | 1897 { |
| 1898 alias_ty p; | |
| 1899 if (!name) { | |
| 1900 PyErr_SetString(PyExc_ValueError, | |
| 1901 "field name is required for alias"); | |
| 1902 return NULL; | |
| 1903 } | |
|
36065
ea083efdc96c
Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
Neal Norwitz <nnorwitz@gmail.com>
parents:
36003
diff
changeset
|
1904 p = (alias_ty)PyArena_Malloc(arena, sizeof(*p)); |
|
40937
6aa1be5dd009
Merged revisions 53912-53951 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40896
diff
changeset
|
1905 if (!p) |
| 35742 | 1906 return NULL; |
| 1907 p->name = name; | |
| 1908 p->asname = asname; | |
| 1909 return p; | |
| 1910 } | |
| 1911 | |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
1912 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1913 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1914 ast2obj_mod(void* _o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1915 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1916 mod_ty o = (mod_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1917 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1918 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1919 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1920 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1921 } |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
1922 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1923 switch (o->kind) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1924 case Module_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1925 result = PyType_GenericNew(Module_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1926 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1927 value = ast2obj_list(o->v.Module.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1928 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1929 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1930 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1931 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1932 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1933 case Interactive_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1934 result = PyType_GenericNew(Interactive_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1935 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1936 value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1937 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1938 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1939 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1940 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1941 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1942 case Expression_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1943 result = PyType_GenericNew(Expression_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1944 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1945 value = ast2obj_expr(o->v.Expression.body); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1946 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1947 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1948 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1949 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1950 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1951 case Suite_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1952 result = PyType_GenericNew(Suite_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1953 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1954 value = ast2obj_list(o->v.Suite.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1955 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1956 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1957 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1958 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1959 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1960 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1961 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1962 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1963 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1964 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1965 return NULL; |
| 36174 | 1966 } |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
1967 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1968 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1969 ast2obj_stmt(void* _o) |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
1970 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1971 stmt_ty o = (stmt_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1972 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1973 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1974 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1975 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1976 } |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
1977 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1978 switch (o->kind) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1979 case FunctionDef_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1980 result = PyType_GenericNew(FunctionDef_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1981 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1982 value = ast2obj_identifier(o->v.FunctionDef.name); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1983 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1984 if (PyObject_SetAttrString(result, "name", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1985 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1986 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1987 value = ast2obj_arguments(o->v.FunctionDef.args); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1988 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1989 if (PyObject_SetAttrString(result, "args", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1990 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1991 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1992 value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1993 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1994 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1995 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1996 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1997 value = ast2obj_list(o->v.FunctionDef.decorators, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1998 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
1999 if (PyObject_SetAttrString(result, "decorators", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2000 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2001 Py_DECREF(value); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2002 value = ast2obj_expr(o->v.FunctionDef.returns); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2003 if (!value) goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2004 if (PyObject_SetAttrString(result, "returns", value) == -1) |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2005 goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2006 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2007 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2008 case ClassDef_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2009 result = PyType_GenericNew(ClassDef_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2010 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2011 value = ast2obj_identifier(o->v.ClassDef.name); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2012 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2013 if (PyObject_SetAttrString(result, "name", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2014 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2015 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2016 value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2017 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2018 if (PyObject_SetAttrString(result, "bases", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2019 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2020 Py_DECREF(value); |
|
41226
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2021 value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword); |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2022 if (!value) goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2023 if (PyObject_SetAttrString(result, "keywords", value) == -1) |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2024 goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2025 Py_DECREF(value); |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2026 value = ast2obj_expr(o->v.ClassDef.starargs); |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2027 if (!value) goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2028 if (PyObject_SetAttrString(result, "starargs", value) == -1) |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2029 goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2030 Py_DECREF(value); |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2031 value = ast2obj_expr(o->v.ClassDef.kwargs); |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2032 if (!value) goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2033 if (PyObject_SetAttrString(result, "kwargs", value) == -1) |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2034 goto failed; |
|
19f7ff443718
Implement PEP 3115 -- new metaclass syntax and semantics.
Guido van Rossum <guido@python.org>
parents:
40980
diff
changeset
|
2035 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2036 value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2037 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2038 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2039 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2040 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2041 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2042 case Return_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2043 result = PyType_GenericNew(Return_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2044 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2045 value = ast2obj_expr(o->v.Return.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2046 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2047 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2048 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2049 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2050 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2051 case Delete_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2052 result = PyType_GenericNew(Delete_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2053 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2054 value = ast2obj_list(o->v.Delete.targets, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2055 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2056 if (PyObject_SetAttrString(result, "targets", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2057 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2058 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2059 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2060 case Assign_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2061 result = PyType_GenericNew(Assign_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2062 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2063 value = ast2obj_list(o->v.Assign.targets, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2064 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2065 if (PyObject_SetAttrString(result, "targets", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2066 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2067 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2068 value = ast2obj_expr(o->v.Assign.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2069 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2070 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2071 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2072 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2073 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2074 case AugAssign_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2075 result = PyType_GenericNew(AugAssign_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2076 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2077 value = ast2obj_expr(o->v.AugAssign.target); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2078 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2079 if (PyObject_SetAttrString(result, "target", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2080 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2081 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2082 value = ast2obj_operator(o->v.AugAssign.op); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2083 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2084 if (PyObject_SetAttrString(result, "op", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2085 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2086 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2087 value = ast2obj_expr(o->v.AugAssign.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2088 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2089 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2090 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2091 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2092 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2093 case For_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2094 result = PyType_GenericNew(For_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2095 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2096 value = ast2obj_expr(o->v.For.target); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2097 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2098 if (PyObject_SetAttrString(result, "target", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2099 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2100 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2101 value = ast2obj_expr(o->v.For.iter); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2102 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2103 if (PyObject_SetAttrString(result, "iter", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2104 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2105 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2106 value = ast2obj_list(o->v.For.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2107 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2108 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2109 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2110 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2111 value = ast2obj_list(o->v.For.orelse, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2112 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2113 if (PyObject_SetAttrString(result, "orelse", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2114 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2115 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2116 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2117 case While_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2118 result = PyType_GenericNew(While_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2119 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2120 value = ast2obj_expr(o->v.While.test); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2121 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2122 if (PyObject_SetAttrString(result, "test", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2123 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2124 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2125 value = ast2obj_list(o->v.While.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2126 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2127 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2128 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2129 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2130 value = ast2obj_list(o->v.While.orelse, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2131 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2132 if (PyObject_SetAttrString(result, "orelse", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2133 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2134 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2135 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2136 case If_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2137 result = PyType_GenericNew(If_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2138 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2139 value = ast2obj_expr(o->v.If.test); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2140 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2141 if (PyObject_SetAttrString(result, "test", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2142 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2143 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2144 value = ast2obj_list(o->v.If.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2145 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2146 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2147 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2148 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2149 value = ast2obj_list(o->v.If.orelse, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2150 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2151 if (PyObject_SetAttrString(result, "orelse", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2152 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2153 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2154 break; |
|
36695
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2155 case With_kind: |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2156 result = PyType_GenericNew(With_type, NULL, NULL); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2157 if (!result) goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2158 value = ast2obj_expr(o->v.With.context_expr); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2159 if (!value) goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2160 if (PyObject_SetAttrString(result, "context_expr", value) == -1) |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2161 goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2162 Py_DECREF(value); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2163 value = ast2obj_expr(o->v.With.optional_vars); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2164 if (!value) goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2165 if (PyObject_SetAttrString(result, "optional_vars", value) == |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2166 -1) |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2167 goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2168 Py_DECREF(value); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2169 value = ast2obj_list(o->v.With.body, ast2obj_stmt); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2170 if (!value) goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2171 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2172 goto failed; |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2173 Py_DECREF(value); |
|
b6d2f6fd3e11
PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents:
36669
diff
changeset
|
2174 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2175 case Raise_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2176 result = PyType_GenericNew(Raise_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2177 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2178 value = ast2obj_expr(o->v.Raise.type); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2179 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2180 if (PyObject_SetAttrString(result, "type", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2181 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2182 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2183 value = ast2obj_expr(o->v.Raise.inst); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2184 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2185 if (PyObject_SetAttrString(result, "inst", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2186 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2187 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2188 value = ast2obj_expr(o->v.Raise.tback); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2189 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2190 if (PyObject_SetAttrString(result, "tback", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2191 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2192 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2193 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2194 case TryExcept_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2195 result = PyType_GenericNew(TryExcept_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2196 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2197 value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2198 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2199 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2200 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2201 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2202 value = ast2obj_list(o->v.TryExcept.handlers, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2203 ast2obj_excepthandler); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2204 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2205 if (PyObject_SetAttrString(result, "handlers", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2206 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2207 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2208 value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2209 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2210 if (PyObject_SetAttrString(result, "orelse", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2211 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2212 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2213 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2214 case TryFinally_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2215 result = PyType_GenericNew(TryFinally_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2216 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2217 value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2218 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2219 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2220 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2221 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2222 value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2223 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2224 if (PyObject_SetAttrString(result, "finalbody", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2225 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2226 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2227 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2228 case Assert_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2229 result = PyType_GenericNew(Assert_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2230 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2231 value = ast2obj_expr(o->v.Assert.test); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2232 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2233 if (PyObject_SetAttrString(result, "test", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2234 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2235 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2236 value = ast2obj_expr(o->v.Assert.msg); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2237 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2238 if (PyObject_SetAttrString(result, "msg", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2239 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2240 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2241 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2242 case Import_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2243 result = PyType_GenericNew(Import_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2244 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2245 value = ast2obj_list(o->v.Import.names, ast2obj_alias); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2246 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2247 if (PyObject_SetAttrString(result, "names", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2248 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2249 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2250 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2251 case ImportFrom_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2252 result = PyType_GenericNew(ImportFrom_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2253 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2254 value = ast2obj_identifier(o->v.ImportFrom.module); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2255 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2256 if (PyObject_SetAttrString(result, "module", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2257 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2258 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2259 value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2260 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2261 if (PyObject_SetAttrString(result, "names", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2262 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2263 Py_DECREF(value); |
|
36712
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
2264 value = ast2obj_int(o->v.ImportFrom.level); |
|
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
2265 if (!value) goto failed; |
|
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
2266 if (PyObject_SetAttrString(result, "level", value) == -1) |
|
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
2267 goto failed; |
|
5c36c222e7ca
SF patch #1438387, PEP 328: relative and absolute imports.
Thomas Wouters <thomas@python.org>
parents:
36707
diff
changeset
|
2268 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2269 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2270 case Global_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2271 result = PyType_GenericNew(Global_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2272 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2273 value = ast2obj_list(o->v.Global.names, ast2obj_identifier); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2274 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2275 if (PyObject_SetAttrString(result, "names", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2276 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2277 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2278 break; |
|
40965
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2279 case Nonlocal_kind: |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2280 result = PyType_GenericNew(Nonlocal_type, NULL, NULL); |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2281 if (!result) goto failed; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2282 value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier); |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2283 if (!value) goto failed; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2284 if (PyObject_SetAttrString(result, "names", value) == -1) |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2285 goto failed; |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2286 Py_DECREF(value); |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
2287 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2288 case Expr_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2289 result = PyType_GenericNew(Expr_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2290 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2291 value = ast2obj_expr(o->v.Expr.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2292 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2293 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2294 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2295 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2296 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2297 case Pass_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2298 result = PyType_GenericNew(Pass_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2299 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2300 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2301 case Break_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2302 result = PyType_GenericNew(Break_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2303 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2304 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2305 case Continue_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2306 result = PyType_GenericNew(Continue_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2307 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2308 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2309 } |
| 36669 | 2310 value = ast2obj_int(o->lineno); |
| 2311 if (!value) goto failed; | |
|
36794
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2312 if (PyObject_SetAttrString(result, "lineno", value) < 0) |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2313 goto failed; |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2314 Py_DECREF(value); |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
2315 value = ast2obj_int(o->col_offset); |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
2316 if (!value) goto failed; |
|
36794
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2317 if (PyObject_SetAttrString(result, "col_offset", value) < 0) |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2318 goto failed; |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2319 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2320 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2321 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2322 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2323 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2324 return NULL; |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2325 } |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2326 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2327 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2328 ast2obj_expr(void* _o) |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2329 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2330 expr_ty o = (expr_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2331 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2332 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2333 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2334 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2335 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2336 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2337 switch (o->kind) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2338 case BoolOp_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2339 result = PyType_GenericNew(BoolOp_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2340 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2341 value = ast2obj_boolop(o->v.BoolOp.op); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2342 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2343 if (PyObject_SetAttrString(result, "op", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2344 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2345 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2346 value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2347 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2348 if (PyObject_SetAttrString(result, "values", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2349 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2350 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2351 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2352 case BinOp_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2353 result = PyType_GenericNew(BinOp_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2354 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2355 value = ast2obj_expr(o->v.BinOp.left); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2356 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2357 if (PyObject_SetAttrString(result, "left", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2358 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2359 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2360 value = ast2obj_operator(o->v.BinOp.op); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2361 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2362 if (PyObject_SetAttrString(result, "op", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2363 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2364 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2365 value = ast2obj_expr(o->v.BinOp.right); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2366 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2367 if (PyObject_SetAttrString(result, "right", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2368 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2369 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2370 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2371 case UnaryOp_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2372 result = PyType_GenericNew(UnaryOp_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2373 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2374 value = ast2obj_unaryop(o->v.UnaryOp.op); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2375 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2376 if (PyObject_SetAttrString(result, "op", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2377 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2378 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2379 value = ast2obj_expr(o->v.UnaryOp.operand); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2380 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2381 if (PyObject_SetAttrString(result, "operand", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2382 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2383 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2384 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2385 case Lambda_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2386 result = PyType_GenericNew(Lambda_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2387 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2388 value = ast2obj_arguments(o->v.Lambda.args); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2389 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2390 if (PyObject_SetAttrString(result, "args", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2391 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2392 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2393 value = ast2obj_expr(o->v.Lambda.body); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2394 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2395 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2396 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2397 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2398 break; |
|
36666
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2399 case IfExp_kind: |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2400 result = PyType_GenericNew(IfExp_type, NULL, NULL); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2401 if (!result) goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2402 value = ast2obj_expr(o->v.IfExp.test); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2403 if (!value) goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2404 if (PyObject_SetAttrString(result, "test", value) == -1) |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2405 goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2406 Py_DECREF(value); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2407 value = ast2obj_expr(o->v.IfExp.body); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2408 if (!value) goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2409 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2410 goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2411 Py_DECREF(value); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2412 value = ast2obj_expr(o->v.IfExp.orelse); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2413 if (!value) goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2414 if (PyObject_SetAttrString(result, "orelse", value) == -1) |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2415 goto failed; |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2416 Py_DECREF(value); |
|
6165927431d6
PEP 308 implementation, including minor refdocs and some testcases. It
Thomas Wouters <thomas@python.org>
parents:
36665
diff
changeset
|
2417 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2418 case Dict_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2419 result = PyType_GenericNew(Dict_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2420 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2421 value = ast2obj_list(o->v.Dict.keys, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2422 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2423 if (PyObject_SetAttrString(result, "keys", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2424 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2425 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2426 value = ast2obj_list(o->v.Dict.values, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2427 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2428 if (PyObject_SetAttrString(result, "values", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2429 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2430 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2431 break; |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2432 case Set_kind: |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2433 result = PyType_GenericNew(Set_type, NULL, NULL); |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2434 if (!result) goto failed; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2435 value = ast2obj_list(o->v.Set.elts, ast2obj_expr); |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2436 if (!value) goto failed; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2437 if (PyObject_SetAttrString(result, "elts", value) == -1) |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2438 goto failed; |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2439 Py_DECREF(value); |
|
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
2440 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2441 case ListComp_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2442 result = PyType_GenericNew(ListComp_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2443 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2444 value = ast2obj_expr(o->v.ListComp.elt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2445 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2446 if (PyObject_SetAttrString(result, "elt", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2447 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2448 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2449 value = ast2obj_list(o->v.ListComp.generators, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2450 ast2obj_comprehension); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2451 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2452 if (PyObject_SetAttrString(result, "generators", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2453 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2454 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2455 break; |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2456 case SetComp_kind: |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2457 result = PyType_GenericNew(SetComp_type, NULL, NULL); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2458 if (!result) goto failed; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2459 value = ast2obj_expr(o->v.SetComp.elt); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2460 if (!value) goto failed; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2461 if (PyObject_SetAttrString(result, "elt", value) == -1) |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2462 goto failed; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2463 Py_DECREF(value); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2464 value = ast2obj_list(o->v.SetComp.generators, |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2465 ast2obj_comprehension); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2466 if (!value) goto failed; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2467 if (PyObject_SetAttrString(result, "generators", value) == -1) |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2468 goto failed; |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2469 Py_DECREF(value); |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
2470 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2471 case GeneratorExp_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2472 result = PyType_GenericNew(GeneratorExp_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2473 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2474 value = ast2obj_expr(o->v.GeneratorExp.elt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2475 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2476 if (PyObject_SetAttrString(result, "elt", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2477 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2478 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2479 value = ast2obj_list(o->v.GeneratorExp.generators, |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2480 ast2obj_comprehension); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2481 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2482 if (PyObject_SetAttrString(result, "generators", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2483 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2484 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2485 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2486 case Yield_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2487 result = PyType_GenericNew(Yield_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2488 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2489 value = ast2obj_expr(o->v.Yield.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2490 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2491 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2492 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2493 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2494 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2495 case Compare_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2496 result = PyType_GenericNew(Compare_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2497 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2498 value = ast2obj_expr(o->v.Compare.left); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2499 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2500 if (PyObject_SetAttrString(result, "left", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2501 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2502 Py_DECREF(value); |
|
36661
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2503 { |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2504 int i, n = asdl_seq_LEN(o->v.Compare.ops); |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2505 value = PyList_New(n); |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2506 if (!value) goto failed; |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2507 for(i = 0; i < n; i++) |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2508 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); |
|
710cbdd478a8
Fix iterating over cmpop_ty lists.
Martin v. Löwis <martin@v.loewis.de>
parents:
36660
diff
changeset
|
2509 } |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2510 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2511 if (PyObject_SetAttrString(result, "ops", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2512 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2513 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2514 value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2515 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2516 if (PyObject_SetAttrString(result, "comparators", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2517 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2518 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2519 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2520 case Call_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2521 result = PyType_GenericNew(Call_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2522 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2523 value = ast2obj_expr(o->v.Call.func); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2524 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2525 if (PyObject_SetAttrString(result, "func", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2526 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2527 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2528 value = ast2obj_list(o->v.Call.args, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2529 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2530 if (PyObject_SetAttrString(result, "args", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2531 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2532 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2533 value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2534 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2535 if (PyObject_SetAttrString(result, "keywords", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2536 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2537 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2538 value = ast2obj_expr(o->v.Call.starargs); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2539 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2540 if (PyObject_SetAttrString(result, "starargs", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2541 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2542 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2543 value = ast2obj_expr(o->v.Call.kwargs); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2544 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2545 if (PyObject_SetAttrString(result, "kwargs", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2546 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2547 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2548 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2549 case Num_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2550 result = PyType_GenericNew(Num_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2551 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2552 value = ast2obj_object(o->v.Num.n); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2553 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2554 if (PyObject_SetAttrString(result, "n", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2555 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2556 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2557 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2558 case Str_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2559 result = PyType_GenericNew(Str_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2560 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2561 value = ast2obj_string(o->v.Str.s); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2562 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2563 if (PyObject_SetAttrString(result, "s", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2564 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2565 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2566 break; |
| 40894 | 2567 case Bytes_kind: |
| 2568 result = PyType_GenericNew(Bytes_type, NULL, NULL); | |
| 2569 if (!result) goto failed; | |
| 2570 value = ast2obj_string(o->v.Bytes.s); | |
| 2571 if (!value) goto failed; | |
| 2572 if (PyObject_SetAttrString(result, "s", value) == -1) | |
| 2573 goto failed; | |
| 2574 Py_DECREF(value); | |
| 2575 break; | |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
2576 case Ellipsis_kind: |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
2577 result = PyType_GenericNew(Ellipsis_type, NULL, NULL); |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
2578 if (!result) goto failed; |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
2579 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2580 case Attribute_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2581 result = PyType_GenericNew(Attribute_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2582 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2583 value = ast2obj_expr(o->v.Attribute.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2584 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2585 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2586 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2587 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2588 value = ast2obj_identifier(o->v.Attribute.attr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2589 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2590 if (PyObject_SetAttrString(result, "attr", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2591 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2592 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2593 value = ast2obj_expr_context(o->v.Attribute.ctx); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2594 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2595 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2596 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2597 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2598 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2599 case Subscript_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2600 result = PyType_GenericNew(Subscript_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2601 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2602 value = ast2obj_expr(o->v.Subscript.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2603 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2604 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2605 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2606 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2607 value = ast2obj_slice(o->v.Subscript.slice); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2608 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2609 if (PyObject_SetAttrString(result, "slice", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2610 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2611 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2612 value = ast2obj_expr_context(o->v.Subscript.ctx); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2613 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2614 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2615 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2616 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2617 break; |
|
41699
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2618 case Starred_kind: |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2619 result = PyType_GenericNew(Starred_type, NULL, NULL); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2620 if (!result) goto failed; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2621 value = ast2obj_expr(o->v.Starred.value); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2622 if (!value) goto failed; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2623 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2624 goto failed; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2625 Py_DECREF(value); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2626 value = ast2obj_expr_context(o->v.Starred.ctx); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2627 if (!value) goto failed; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2628 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2629 goto failed; |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2630 Py_DECREF(value); |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
2631 break; |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2632 case Name_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2633 result = PyType_GenericNew(Name_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2634 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2635 value = ast2obj_identifier(o->v.Name.id); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2636 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2637 if (PyObject_SetAttrString(result, "id", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2638 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2639 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2640 value = ast2obj_expr_context(o->v.Name.ctx); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2641 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2642 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2643 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2644 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2645 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2646 case List_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2647 result = PyType_GenericNew(List_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2648 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2649 value = ast2obj_list(o->v.List.elts, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2650 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2651 if (PyObject_SetAttrString(result, "elts", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2652 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2653 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2654 value = ast2obj_expr_context(o->v.List.ctx); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2655 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2656 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2657 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2658 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2659 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2660 case Tuple_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2661 result = PyType_GenericNew(Tuple_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2662 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2663 value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2664 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2665 if (PyObject_SetAttrString(result, "elts", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2666 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2667 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2668 value = ast2obj_expr_context(o->v.Tuple.ctx); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2669 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2670 if (PyObject_SetAttrString(result, "ctx", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2671 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2672 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2673 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2674 } |
| 36669 | 2675 value = ast2obj_int(o->lineno); |
| 2676 if (!value) goto failed; | |
|
36794
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2677 if (PyObject_SetAttrString(result, "lineno", value) < 0) |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2678 goto failed; |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2679 Py_DECREF(value); |
|
36786
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
2680 value = ast2obj_int(o->col_offset); |
|
57322cb2ca11
Patch #1440601: Add col_offset attribute to AST nodes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36743
diff
changeset
|
2681 if (!value) goto failed; |
|
36794
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2682 if (PyObject_SetAttrString(result, "col_offset", value) < 0) |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2683 goto failed; |
|
df843b07f5fe
Fix memory leak on attributes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36786
diff
changeset
|
2684 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2685 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2686 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2687 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2688 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2689 return NULL; |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2690 } |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2691 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2692 PyObject* ast2obj_expr_context(expr_context_ty o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2693 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2694 switch(o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2695 case Load: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2696 Py_INCREF(Load_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2697 return Load_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2698 case Store: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2699 Py_INCREF(Store_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2700 return Store_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2701 case Del: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2702 Py_INCREF(Del_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2703 return Del_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2704 case AugLoad: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2705 Py_INCREF(AugLoad_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2706 return AugLoad_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2707 case AugStore: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2708 Py_INCREF(AugStore_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2709 return AugStore_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2710 case Param: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2711 Py_INCREF(Param_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2712 return Param_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2713 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2714 return NULL; /* cannot happen */ |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2715 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2716 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2717 ast2obj_slice(void* _o) |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2718 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2719 slice_ty o = (slice_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2720 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2721 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2722 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2723 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2724 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2725 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2726 switch (o->kind) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2727 case Slice_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2728 result = PyType_GenericNew(Slice_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2729 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2730 value = ast2obj_expr(o->v.Slice.lower); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2731 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2732 if (PyObject_SetAttrString(result, "lower", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2733 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2734 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2735 value = ast2obj_expr(o->v.Slice.upper); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2736 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2737 if (PyObject_SetAttrString(result, "upper", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2738 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2739 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2740 value = ast2obj_expr(o->v.Slice.step); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2741 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2742 if (PyObject_SetAttrString(result, "step", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2743 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2744 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2745 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2746 case ExtSlice_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2747 result = PyType_GenericNew(ExtSlice_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2748 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2749 value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2750 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2751 if (PyObject_SetAttrString(result, "dims", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2752 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2753 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2754 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2755 case Index_kind: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2756 result = PyType_GenericNew(Index_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2757 if (!result) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2758 value = ast2obj_expr(o->v.Index.value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2759 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2760 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2761 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2762 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2763 break; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2764 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2765 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2766 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2767 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2768 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2769 return NULL; |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2770 } |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2771 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2772 PyObject* ast2obj_boolop(boolop_ty o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2773 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2774 switch(o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2775 case And: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2776 Py_INCREF(And_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2777 return And_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2778 case Or: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2779 Py_INCREF(Or_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2780 return Or_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2781 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2782 return NULL; /* cannot happen */ |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2783 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2784 PyObject* ast2obj_operator(operator_ty o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2785 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2786 switch(o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2787 case Add: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2788 Py_INCREF(Add_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2789 return Add_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2790 case Sub: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2791 Py_INCREF(Sub_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2792 return Sub_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2793 case Mult: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2794 Py_INCREF(Mult_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2795 return Mult_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2796 case Div: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2797 Py_INCREF(Div_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2798 return Div_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2799 case Mod: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2800 Py_INCREF(Mod_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2801 return Mod_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2802 case Pow: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2803 Py_INCREF(Pow_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2804 return Pow_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2805 case LShift: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2806 Py_INCREF(LShift_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2807 return LShift_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2808 case RShift: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2809 Py_INCREF(RShift_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2810 return RShift_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2811 case BitOr: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2812 Py_INCREF(BitOr_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2813 return BitOr_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2814 case BitXor: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2815 Py_INCREF(BitXor_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2816 return BitXor_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2817 case BitAnd: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2818 Py_INCREF(BitAnd_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2819 return BitAnd_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2820 case FloorDiv: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2821 Py_INCREF(FloorDiv_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2822 return FloorDiv_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2823 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2824 return NULL; /* cannot happen */ |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2825 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2826 PyObject* ast2obj_unaryop(unaryop_ty o) |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2827 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2828 switch(o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2829 case Invert: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2830 Py_INCREF(Invert_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2831 return Invert_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2832 case Not: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2833 Py_INCREF(Not_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2834 return Not_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2835 case UAdd: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2836 Py_INCREF(UAdd_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2837 return UAdd_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2838 case USub: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2839 Py_INCREF(USub_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2840 return USub_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2841 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2842 return NULL; /* cannot happen */ |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2843 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2844 PyObject* ast2obj_cmpop(cmpop_ty o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2845 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2846 switch(o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2847 case Eq: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2848 Py_INCREF(Eq_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2849 return Eq_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2850 case NotEq: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2851 Py_INCREF(NotEq_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2852 return NotEq_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2853 case Lt: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2854 Py_INCREF(Lt_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2855 return Lt_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2856 case LtE: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2857 Py_INCREF(LtE_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2858 return LtE_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2859 case Gt: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2860 Py_INCREF(Gt_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2861 return Gt_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2862 case GtE: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2863 Py_INCREF(GtE_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2864 return GtE_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2865 case Is: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2866 Py_INCREF(Is_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2867 return Is_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2868 case IsNot: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2869 Py_INCREF(IsNot_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2870 return IsNot_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2871 case In: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2872 Py_INCREF(In_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2873 return In_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2874 case NotIn: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2875 Py_INCREF(NotIn_singleton); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2876 return NotIn_singleton; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2877 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2878 return NULL; /* cannot happen */ |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2879 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2880 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2881 ast2obj_comprehension(void* _o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2882 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2883 comprehension_ty o = (comprehension_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2884 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2885 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2886 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2887 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2888 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2889 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2890 result = PyType_GenericNew(comprehension_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2891 if (!result) return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2892 value = ast2obj_expr(o->target); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2893 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2894 if (PyObject_SetAttrString(result, "target", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2895 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2896 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2897 value = ast2obj_expr(o->iter); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2898 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2899 if (PyObject_SetAttrString(result, "iter", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2900 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2901 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2902 value = ast2obj_list(o->ifs, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2903 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2904 if (PyObject_SetAttrString(result, "ifs", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2905 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2906 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2907 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2908 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2909 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2910 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2911 return NULL; |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2912 } |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2913 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2914 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2915 ast2obj_excepthandler(void* _o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2916 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2917 excepthandler_ty o = (excepthandler_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2918 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2919 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2920 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2921 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2922 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2923 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2924 result = PyType_GenericNew(excepthandler_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2925 if (!result) return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2926 value = ast2obj_expr(o->type); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2927 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2928 if (PyObject_SetAttrString(result, "type", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2929 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2930 Py_DECREF(value); |
|
40588
4bab65fcca8e
Some more changes related to the new except syntax and semantics,
Guido van Rossum <guido@python.org>
parents:
40563
diff
changeset
|
2931 value = ast2obj_identifier(o->name); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2932 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2933 if (PyObject_SetAttrString(result, "name", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2934 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2935 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2936 value = ast2obj_list(o->body, ast2obj_stmt); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2937 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2938 if (PyObject_SetAttrString(result, "body", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2939 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2940 Py_DECREF(value); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2941 value = ast2obj_int(o->lineno); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2942 if (!value) goto failed; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2943 if (PyObject_SetAttrString(result, "lineno", value) == -1) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2944 goto failed; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2945 Py_DECREF(value); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2946 value = ast2obj_int(o->col_offset); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2947 if (!value) goto failed; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2948 if (PyObject_SetAttrString(result, "col_offset", value) == -1) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2949 goto failed; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
2950 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2951 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2952 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2953 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2954 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2955 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2956 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2957 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2958 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2959 ast2obj_arguments(void* _o) |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
2960 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2961 arguments_ty o = (arguments_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2962 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2963 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2964 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2965 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2966 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2967 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2968 result = PyType_GenericNew(arguments_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2969 if (!result) return NULL; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2970 value = ast2obj_list(o->args, ast2obj_arg); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2971 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2972 if (PyObject_SetAttrString(result, "args", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2973 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2974 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2975 value = ast2obj_identifier(o->vararg); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2976 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2977 if (PyObject_SetAttrString(result, "vararg", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2978 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2979 Py_DECREF(value); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2980 value = ast2obj_expr(o->varargannotation); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2981 if (!value) goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2982 if (PyObject_SetAttrString(result, "varargannotation", value) == -1) |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2983 goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2984 Py_DECREF(value); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2985 value = ast2obj_list(o->kwonlyargs, ast2obj_arg); |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
2986 if (!value) goto failed; |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
2987 if (PyObject_SetAttrString(result, "kwonlyargs", value) == -1) |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
2988 goto failed; |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
2989 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2990 value = ast2obj_identifier(o->kwarg); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2991 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2992 if (PyObject_SetAttrString(result, "kwarg", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2993 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
2994 Py_DECREF(value); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2995 value = ast2obj_expr(o->kwargannotation); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2996 if (!value) goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2997 if (PyObject_SetAttrString(result, "kwargannotation", value) == -1) |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2998 goto failed; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
2999 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3000 value = ast2obj_list(o->defaults, ast2obj_expr); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3001 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3002 if (PyObject_SetAttrString(result, "defaults", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3003 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3004 Py_DECREF(value); |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
3005 value = ast2obj_list(o->kw_defaults, ast2obj_expr); |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
3006 if (!value) goto failed; |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
3007 if (PyObject_SetAttrString(result, "kw_defaults", value) == -1) |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
3008 goto failed; |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39783
diff
changeset
|
3009 Py_DECREF(value); |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3010 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3011 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3012 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3013 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3014 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3015 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3016 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3017 PyObject* |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3018 ast2obj_arg(void* _o) |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3019 { |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3020 arg_ty o = (arg_ty)_o; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3021 PyObject *result = NULL, *value = NULL; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3022 if (!o) { |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3023 Py_INCREF(Py_None); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3024 return Py_None; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3025 } |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3026 |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3027 result = PyType_GenericNew(arg_type, NULL, NULL); |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3028 if (!result) return NULL; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3029 value = ast2obj_identifier(o->arg); |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3030 if (!value) goto failed; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3031 if (PyObject_SetAttrString(result, "arg", value) == -1) |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3032 goto failed; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3033 Py_DECREF(value); |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3034 value = ast2obj_expr(o->annotation); |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3035 if (!value) goto failed; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3036 if (PyObject_SetAttrString(result, "annotation", value) == -1) |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3037 goto failed; |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41699
diff
changeset
|
3038 Py_DECREF(value); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3039 return result; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3040 failed: |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3041 Py_XDECREF(value); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3042 Py_XDECREF(result); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3043 return NULL; |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3044 } |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3045 |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3046 PyObject* |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3047 ast2obj_keyword(void* _o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3048 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3049 keyword_ty o = (keyword_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3050 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3051 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3052 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3053 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3054 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3055 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3056 result = PyType_GenericNew(keyword_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3057 if (!result) return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3058 value = ast2obj_identifier(o->arg); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3059 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3060 if (PyObject_SetAttrString(result, "arg", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3061 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3062 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3063 value = ast2obj_expr(o->value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3064 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3065 if (PyObject_SetAttrString(result, "value", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3066 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3067 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3068 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3069 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3070 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3071 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3072 return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3073 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3074 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3075 PyObject* |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3076 ast2obj_alias(void* _o) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3077 { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3078 alias_ty o = (alias_ty)_o; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3079 PyObject *result = NULL, *value = NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3080 if (!o) { |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3081 Py_INCREF(Py_None); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3082 return Py_None; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3083 } |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3084 |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3085 result = PyType_GenericNew(alias_type, NULL, NULL); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3086 if (!result) return NULL; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3087 value = ast2obj_identifier(o->name); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3088 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3089 if (PyObject_SetAttrString(result, "name", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3090 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3091 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3092 value = ast2obj_identifier(o->asname); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3093 if (!value) goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3094 if (PyObject_SetAttrString(result, "asname", value) == -1) |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3095 goto failed; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3096 Py_DECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3097 return result; |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3098 failed: |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3099 Py_XDECREF(value); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3100 Py_XDECREF(result); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3101 return NULL; |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
3102 } |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
3103 |
|
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
3104 |
| 36669 | 3105 PyMODINIT_FUNC |
| 3106 init_ast(void) | |
| 3107 { | |
| 3108 PyObject *m, *d; | |
| 3109 if (!init_types()) return; | |
| 3110 m = Py_InitModule3("_ast", NULL, NULL); | |
| 3111 if (!m) return; | |
| 3112 d = PyModule_GetDict(m); | |
| 3113 if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return; | |
| 3114 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) | |
| 3115 return; | |
| 41722 | 3116 if (PyModule_AddStringConstant(m, "__version__", "55343") < 0) |
| 36707 | 3117 return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3118 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3119 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3120 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3121 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3122 < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3123 if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3124 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3125 if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3126 if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3127 if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3128 < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3129 if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3130 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3131 if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3132 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3133 if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3134 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3135 if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3136 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3137 if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3138 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3139 if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3140 if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3141 if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3142 if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3143 if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3144 if (PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3145 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3146 if (PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3147 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3148 if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3149 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3150 if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3151 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3152 if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3153 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3154 if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3155 return; |
|
40965
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
3156 if (PyDict_SetItemString(d, "Nonlocal", (PyObject*)Nonlocal_type) < 0) |
|
30e5cb3a55ac
Provisional implementation of PEP 3104.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
40941
diff
changeset
|
3157 return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3158 if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3159 if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3160 if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3161 if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3162 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3163 if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3164 if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3165 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3166 if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3167 if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3168 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3169 if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3170 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3171 if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3172 if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return; |
|
39693
d0b83c4630c0
SF patch 1547796 by Georg Brandl -- set literals.
Guido van Rossum <guido@python.org>
parents:
39691
diff
changeset
|
3173 if (PyDict_SetItemString(d, "Set", (PyObject*)Set_type) < 0) return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3174 if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3175 return; |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
3176 if (PyDict_SetItemString(d, "SetComp", (PyObject*)SetComp_type) < 0) |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41227
diff
changeset
|
3177 return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3178 if (PyDict_SetItemString(d, "GeneratorExp", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3179 (PyObject*)GeneratorExp_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3180 if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3181 if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3182 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3183 if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3184 if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3185 if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; |
| 40894 | 3186 if (PyDict_SetItemString(d, "Bytes", (PyObject*)Bytes_type) < 0) return; |
|
39783
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
3187 if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) |
|
7a0ad110e91e
Patch #1550786: ellipsis literal.
Georg Brandl <georg@python.org>
parents:
39782
diff
changeset
|
3188 return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3189 if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3190 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3191 if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3192 0) return; |
|
41699
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
3193 if (PyDict_SetItemString(d, "Starred", (PyObject*)Starred_type) < 0) |
|
e16c8e5c5ca4
Merged revisions 55225-55227,55229-55269 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41471
diff
changeset
|
3194 return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3195 if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3196 if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3197 if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3198 if (PyDict_SetItemString(d, "expr_context", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3199 (PyObject*)expr_context_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3200 if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3201 if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3202 if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3203 if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3204 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3205 if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3206 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3207 if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3208 if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3209 if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3210 if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3211 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3212 if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3213 if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3214 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3215 if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3216 if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3217 if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3218 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3219 if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3220 if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3221 if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3222 if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3223 if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3224 if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3225 if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3226 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3227 if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3228 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3229 if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3230 if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3231 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3232 if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3233 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3234 if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3235 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3236 if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3237 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3238 if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3239 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3240 if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3241 if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3242 if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3243 if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3244 if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3245 if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3246 if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3247 if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3248 if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3249 if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3250 if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3251 if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3252 if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3253 if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3254 if (PyDict_SetItemString(d, "comprehension", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3255 (PyObject*)comprehension_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3256 if (PyDict_SetItemString(d, "excepthandler", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3257 (PyObject*)excepthandler_type) < 0) return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3258 if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3259 0) return; |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
3260 if (PyDict_SetItemString(d, "arg", (PyObject*)arg_type) < 0) return; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3261 if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3262 return; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36794
diff
changeset
|
3263 if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return; |
| 36669 | 3264 } |
| 3265 | |
| 35742 | 3266 |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3267 PyObject* PyAST_mod2obj(mod_ty t) |
| 35742 | 3268 { |
|
36660
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3269 init_types(); |
|
3c0b26113df6
Generate code to recursively copy an AST into
Martin v. Löwis <martin@v.loewis.de>
parents:
36174
diff
changeset
|
3270 return ast2obj_mod(t); |
| 35742 | 3271 } |
| 3272 | |
|
35866
9f73dc0953d2
Whoops, checkin consistent versions of *all* files to stop polluting
Neal Norwitz <nnorwitz@gmail.com>
parents:
35862
diff
changeset
|
3273 |
