@@ -212,6 +212,7 @@ static PyTypeObject *Str_type;
212
212
static char * Str_fields []= {
213
213
"s" ,
214
214
};
215
+ static PyTypeObject * Ellipsis_type ;
215
216
static PyTypeObject * Attribute_type ;
216
217
static char * Attribute_fields []= {
217
218
"value" ,
@@ -251,7 +252,6 @@ static PyTypeObject *AugStore_type;
251
252
static PyTypeObject * Param_type ;
252
253
static PyTypeObject * slice_type ;
253
254
static PyObject * ast2obj_slice (void * );
254
- static PyTypeObject * Ellipsis_type ;
255
255
static PyTypeObject * Slice_type ;
256
256
static char * Slice_fields []= {
257
257
"lower" ,
@@ -530,6 +530,8 @@ static int init_types(void)
530
530
if (!Num_type ) return 0 ;
531
531
Str_type = make_type ("Str" , expr_type , Str_fields , 1 );
532
532
if (!Str_type ) return 0 ;
533
+ Ellipsis_type = make_type ("Ellipsis" , expr_type , NULL , 0 );
534
+ if (!Ellipsis_type ) return 0 ;
533
535
Attribute_type = make_type ("Attribute" , expr_type , Attribute_fields , 3 );
534
536
if (!Attribute_type ) return 0 ;
535
537
Subscript_type = make_type ("Subscript" , expr_type , Subscript_fields , 3 );
@@ -570,8 +572,6 @@ static int init_types(void)
570
572
slice_type = make_type ("slice" , AST_type , NULL , 0 );
571
573
if (!slice_type ) return 0 ;
572
574
if (!add_attributes (slice_type , NULL , 0 )) return 0 ;
573
- Ellipsis_type = make_type ("Ellipsis" , slice_type , NULL , 0 );
574
- if (!Ellipsis_type ) return 0 ;
575
575
Slice_type = make_type ("Slice" , slice_type , Slice_fields , 3 );
576
576
if (!Slice_type ) return 0 ;
577
577
ExtSlice_type = make_type ("ExtSlice" , slice_type , ExtSlice_fields , 1 );
@@ -1578,6 +1578,21 @@ Str(string s, int lineno, int col_offset, PyArena *arena)
1578
1578
return p ;
1579
1579
}
1580
1580
1581
+ expr_ty
1582
+ Ellipsis (int lineno , int col_offset , PyArena * arena )
1583
+ {
1584
+ expr_ty p ;
1585
+ p = (expr_ty )PyArena_Malloc (arena , sizeof (* p ));
1586
+ if (!p ) {
1587
+ PyErr_NoMemory ();
1588
+ return NULL ;
1589
+ }
1590
+ p -> kind = Ellipsis_kind ;
1591
+ p -> lineno = lineno ;
1592
+ p -> col_offset = col_offset ;
1593
+ return p ;
1594
+ }
1595
+
1581
1596
expr_ty
1582
1597
Attribute (expr_ty value , identifier attr , expr_context_ty ctx , int lineno , int
1583
1598
col_offset , PyArena * arena )
@@ -1720,19 +1735,6 @@ Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
1720
1735
return p ;
1721
1736
}
1722
1737
1723
- slice_ty
1724
- Ellipsis (PyArena * arena )
1725
- {
1726
- slice_ty p ;
1727
- p = (slice_ty )PyArena_Malloc (arena , sizeof (* p ));
1728
- if (!p ) {
1729
- PyErr_NoMemory ();
1730
- return NULL ;
1731
- }
1732
- p -> kind = Ellipsis_kind ;
1733
- return p ;
1734
- }
1735
-
1736
1738
slice_ty
1737
1739
Slice (expr_ty lower , expr_ty upper , expr_ty step , PyArena * arena )
1738
1740
{
@@ -2515,6 +2517,10 @@ ast2obj_expr(void* _o)
2515
2517
goto failed ;
2516
2518
Py_DECREF (value );
2517
2519
break ;
2520
+ case Ellipsis_kind :
2521
+ result = PyType_GenericNew (Ellipsis_type , NULL , NULL );
2522
+ if (!result ) goto failed ;
2523
+ break ;
2518
2524
case Attribute_kind :
2519
2525
result = PyType_GenericNew (Attribute_type , NULL , NULL );
2520
2526
if (!result ) goto failed ;
@@ -2648,10 +2654,6 @@ ast2obj_slice(void* _o)
2648
2654
}
2649
2655
2650
2656
switch (o -> kind ) {
2651
- case Ellipsis_kind :
2652
- result = PyType_GenericNew (Ellipsis_type , NULL , NULL );
2653
- if (!result ) goto failed ;
2654
- break ;
2655
2657
case Slice_kind :
2656
2658
result = PyType_GenericNew (Slice_type , NULL , NULL );
2657
2659
if (!result ) goto failed ;
@@ -3059,6 +3061,8 @@ init_ast(void)
3059
3061
if (PyDict_SetItemString (d , "Call" , (PyObject * )Call_type ) < 0 ) return ;
3060
3062
if (PyDict_SetItemString (d , "Num" , (PyObject * )Num_type ) < 0 ) return ;
3061
3063
if (PyDict_SetItemString (d , "Str" , (PyObject * )Str_type ) < 0 ) return ;
3064
+ if (PyDict_SetItemString (d , "Ellipsis" , (PyObject * )Ellipsis_type ) < 0 )
3065
+ return ;
3062
3066
if (PyDict_SetItemString (d , "Attribute" , (PyObject * )Attribute_type ) <
3063
3067
0 ) return ;
3064
3068
if (PyDict_SetItemString (d , "Subscript" , (PyObject * )Subscript_type ) <
@@ -3077,8 +3081,6 @@ init_ast(void)
3077
3081
return ;
3078
3082
if (PyDict_SetItemString (d , "Param" , (PyObject * )Param_type ) < 0 ) return ;
3079
3083
if (PyDict_SetItemString (d , "slice" , (PyObject * )slice_type ) < 0 ) return ;
3080
- if (PyDict_SetItemString (d , "Ellipsis" , (PyObject * )Ellipsis_type ) < 0 )
3081
- return ;
3082
3084
if (PyDict_SetItemString (d , "Slice" , (PyObject * )Slice_type ) < 0 ) return ;
3083
3085
if (PyDict_SetItemString (d , "ExtSlice" , (PyObject * )ExtSlice_type ) < 0 )
3084
3086
return ;
0 commit comments