Skip to content

gh-111178: Fix function signatures in Python-ast.c #124942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,9 @@ def visitModule(self, mod):
} 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);
Expand All @@ -856,16 +857,18 @@ def visitModule(self, mod):
}

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;
}
Expand Down Expand Up @@ -1651,9 +1654,9 @@ def visitModule(self, mod):
}

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[] = {
Expand Down Expand Up @@ -1847,8 +1850,9 @@ def visitModule(self, mod):

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;
}
Expand Down Expand Up @@ -2296,7 +2300,7 @@ def generate_module_def(mod, metadata, f, internal_h):
};

// Forward declaration
static int init_types(struct ast_state *state);
static int init_types(void *arg);

static struct ast_state*
get_ast_state(void)
Expand Down
18 changes: 11 additions & 7 deletions Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading