@@ -843,8 +843,9 @@ def visitModule(self, mod):
843843} AST_object;
844844
845845static void
846- ast_dealloc(AST_object *self )
846+ ast_dealloc(PyObject *op )
847847{
848+ AST_object *self = (AST_object*)op;
848849 /* bpo-31095: UnTrack is needed before calling any callbacks */
849850 PyTypeObject *tp = Py_TYPE(self);
850851 PyObject_GC_UnTrack(self);
@@ -856,16 +857,18 @@ def visitModule(self, mod):
856857}
857858
858859static int
859- ast_traverse(AST_object *self , visitproc visit, void *arg)
860+ ast_traverse(PyObject *op , visitproc visit, void *arg)
860861{
862+ AST_object *self = (AST_object*)op;
861863 Py_VISIT(Py_TYPE(self));
862864 Py_VISIT(self->dict);
863865 return 0;
864866}
865867
866868static int
867- ast_clear(AST_object *self )
869+ ast_clear(PyObject *op )
868870{
871+ AST_object *self = (AST_object*)op;
869872 Py_CLEAR(self->dict);
870873 return 0;
871874}
@@ -1651,9 +1654,9 @@ def visitModule(self, mod):
16511654}
16521655
16531656static PyObject *
1654- ast_repr(AST_object *self)
1657+ ast_repr(PyObject *self)
16551658{
1656- return ast_repr_max_depth(self, 3);
1659+ return ast_repr_max_depth((AST_object*) self, 3);
16571660}
16581661
16591662static PyType_Slot AST_type_slots[] = {
@@ -1847,8 +1850,9 @@ def visitModule(self, mod):
18471850
18481851 self .file .write (textwrap .dedent ('''
18491852 static int
1850- init_types(struct ast_state *state )
1853+ init_types(void *arg )
18511854 {
1855+ struct ast_state *state = arg;
18521856 if (init_identifiers(state) < 0) {
18531857 return -1;
18541858 }
@@ -2296,7 +2300,7 @@ def generate_module_def(mod, metadata, f, internal_h):
22962300 };
22972301
22982302 // Forward declaration
2299- static int init_types(struct ast_state *state );
2303+ static int init_types(void *arg );
23002304
23012305 static struct ast_state*
23022306 get_ast_state(void)
0 commit comments