@@ -843,8 +843,9 @@ def visitModule(self, mod):
843
843
} AST_object;
844
844
845
845
static void
846
- ast_dealloc(AST_object *self )
846
+ ast_dealloc(PyObject *op )
847
847
{
848
+ AST_object *self = (AST_object*)op;
848
849
/* bpo-31095: UnTrack is needed before calling any callbacks */
849
850
PyTypeObject *tp = Py_TYPE(self);
850
851
PyObject_GC_UnTrack(self);
@@ -856,16 +857,18 @@ def visitModule(self, mod):
856
857
}
857
858
858
859
static int
859
- ast_traverse(AST_object *self , visitproc visit, void *arg)
860
+ ast_traverse(PyObject *op , visitproc visit, void *arg)
860
861
{
862
+ AST_object *self = (AST_object*)op;
861
863
Py_VISIT(Py_TYPE(self));
862
864
Py_VISIT(self->dict);
863
865
return 0;
864
866
}
865
867
866
868
static int
867
- ast_clear(AST_object *self )
869
+ ast_clear(PyObject *op )
868
870
{
871
+ AST_object *self = (AST_object*)op;
869
872
Py_CLEAR(self->dict);
870
873
return 0;
871
874
}
@@ -1651,9 +1654,9 @@ def visitModule(self, mod):
1651
1654
}
1652
1655
1653
1656
static PyObject *
1654
- ast_repr(AST_object *self)
1657
+ ast_repr(PyObject *self)
1655
1658
{
1656
- return ast_repr_max_depth(self, 3);
1659
+ return ast_repr_max_depth((AST_object*) self, 3);
1657
1660
}
1658
1661
1659
1662
static PyType_Slot AST_type_slots[] = {
@@ -1847,8 +1850,9 @@ def visitModule(self, mod):
1847
1850
1848
1851
self .file .write (textwrap .dedent ('''
1849
1852
static int
1850
- init_types(struct ast_state *state )
1853
+ init_types(void *arg )
1851
1854
{
1855
+ struct ast_state *state = arg;
1852
1856
if (init_identifiers(state) < 0) {
1853
1857
return -1;
1854
1858
}
@@ -2296,7 +2300,7 @@ def generate_module_def(mod, metadata, f, internal_h):
2296
2300
};
2297
2301
2298
2302
// Forward declaration
2299
- static int init_types(struct ast_state *state );
2303
+ static int init_types(void *arg );
2300
2304
2301
2305
static struct ast_state*
2302
2306
get_ast_state(void)
0 commit comments