} AST_object;
static void
-ast_dealloc(AST_object *self)
+ast_dealloc(PyObject *op)
{
+ AST_object *self = (AST_object*)op;
/* bpo-31095: UnTrack is needed before calling any callbacks */
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
}
static int
-ast_traverse(AST_object *self, visitproc visit, void *arg)
+ast_traverse(PyObject *op, visitproc visit, void *arg)
{
+ AST_object *self = (AST_object*)op;
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->dict);
return 0;
}
static int
-ast_clear(AST_object *self)
+ast_clear(PyObject *op)
{
+ AST_object *self = (AST_object*)op;
Py_CLEAR(self->dict);
return 0;
}
}
static PyObject *
-ast_repr(AST_object *self)
+ast_repr(PyObject *self)
{
- return ast_repr_max_depth(self, 3);
+ return ast_repr_max_depth((AST_object*)self, 3);
}
static PyType_Slot AST_type_slots[] = {
self.file.write(textwrap.dedent('''
static int
- init_types(struct ast_state *state)
+ init_types(void *arg)
{
+ struct ast_state *state = arg;
if (init_identifiers(state) < 0) {
return -1;
}
};
// Forward declaration
- static int init_types(struct ast_state *state);
+ static int init_types(void *arg);
static struct ast_state*
get_ast_state(void)
};
// Forward declaration
-static int init_types(struct ast_state *state);
+static int init_types(void *arg);
static struct ast_state*
get_ast_state(void)
} AST_object;
static void
-ast_dealloc(AST_object *self)
+ast_dealloc(PyObject *op)
{
+ AST_object *self = (AST_object*)op;
/* bpo-31095: UnTrack is needed before calling any callbacks */
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
}
static int
-ast_traverse(AST_object *self, visitproc visit, void *arg)
+ast_traverse(PyObject *op, visitproc visit, void *arg)
{
+ AST_object *self = (AST_object*)op;
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->dict);
return 0;
}
static int
-ast_clear(AST_object *self)
+ast_clear(PyObject *op)
{
+ AST_object *self = (AST_object*)op;
Py_CLEAR(self->dict);
return 0;
}
}
static PyObject *
-ast_repr(AST_object *self)
+ast_repr(PyObject *self)
{
- return ast_repr_max_depth(self, 3);
+ return ast_repr_max_depth((AST_object*)self, 3);
}
static PyType_Slot AST_type_slots[] = {
static int
-init_types(struct ast_state *state)
+init_types(void *arg)
{
+ struct ast_state *state = arg;
if (init_identifiers(state) < 0) {
return -1;
}