mirror of https://github.com/python/cpython
gh-111178: Fix function signatures in Python-ast.c (#124942)
This commit is contained in:
parent
f66d785861
commit
6c7d5c6415
|
@ -843,8 +843,9 @@ typedef struct {
|
||||||
} AST_object;
|
} AST_object;
|
||||||
|
|
||||||
static void
|
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 */
|
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||||
PyTypeObject *tp = Py_TYPE(self);
|
PyTypeObject *tp = Py_TYPE(self);
|
||||||
PyObject_GC_UnTrack(self);
|
PyObject_GC_UnTrack(self);
|
||||||
|
@ -856,16 +857,18 @@ ast_dealloc(AST_object *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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(Py_TYPE(self));
|
||||||
Py_VISIT(self->dict);
|
Py_VISIT(self->dict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ast_clear(AST_object *self)
|
ast_clear(PyObject *op)
|
||||||
{
|
{
|
||||||
|
AST_object *self = (AST_object*)op;
|
||||||
Py_CLEAR(self->dict);
|
Py_CLEAR(self->dict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1651,9 +1654,9 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
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 PyType_Slot AST_type_slots[] = {
|
||||||
|
@ -1847,8 +1850,9 @@ static int add_ast_fields(struct ast_state *state)
|
||||||
|
|
||||||
self.file.write(textwrap.dedent('''
|
self.file.write(textwrap.dedent('''
|
||||||
static int
|
static int
|
||||||
init_types(struct ast_state *state)
|
init_types(void *arg)
|
||||||
{
|
{
|
||||||
|
struct ast_state *state = arg;
|
||||||
if (init_identifiers(state) < 0) {
|
if (init_identifiers(state) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2296,7 +2300,7 @@ def generate_module_def(mod, metadata, f, internal_h):
|
||||||
};
|
};
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
static int init_types(struct ast_state *state);
|
static int init_types(void *arg);
|
||||||
|
|
||||||
static struct ast_state*
|
static struct ast_state*
|
||||||
get_ast_state(void)
|
get_ast_state(void)
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct validator {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
static int init_types(struct ast_state *state);
|
static int init_types(void *arg);
|
||||||
|
|
||||||
static struct ast_state*
|
static struct ast_state*
|
||||||
get_ast_state(void)
|
get_ast_state(void)
|
||||||
|
@ -5044,8 +5044,9 @@ typedef struct {
|
||||||
} AST_object;
|
} AST_object;
|
||||||
|
|
||||||
static void
|
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 */
|
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
||||||
PyTypeObject *tp = Py_TYPE(self);
|
PyTypeObject *tp = Py_TYPE(self);
|
||||||
PyObject_GC_UnTrack(self);
|
PyObject_GC_UnTrack(self);
|
||||||
|
@ -5057,16 +5058,18 @@ ast_dealloc(AST_object *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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(Py_TYPE(self));
|
||||||
Py_VISIT(self->dict);
|
Py_VISIT(self->dict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ast_clear(AST_object *self)
|
ast_clear(PyObject *op)
|
||||||
{
|
{
|
||||||
|
AST_object *self = (AST_object*)op;
|
||||||
Py_CLEAR(self->dict);
|
Py_CLEAR(self->dict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5852,9 +5855,9 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
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 PyType_Slot AST_type_slots[] = {
|
||||||
|
@ -6047,8 +6050,9 @@ static int add_ast_fields(struct ast_state *state)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
init_types(struct ast_state *state)
|
init_types(void *arg)
|
||||||
{
|
{
|
||||||
|
struct ast_state *state = arg;
|
||||||
if (init_identifiers(state) < 0) {
|
if (init_identifiers(state) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue