Skip to content

gh-151515 Fix incorrect function pointer cast in asdl_c.py generator #151515

@CoderSilicon

Description

@CoderSilicon

Bug report

Bug description:

Summary

This PR fixes an undefined behavior bug in the C code generated by Parser/asdl_c.py for get_ast_state().

The Problem

In the generated code, _PyOnceFlag_CallOnce is currently being invoked like this:

_PyOnceFlag_CallOnce(&state->once, (_Py_once_fn_t *)&init_types, state)


### CPython versions tested on:

CPython main branch

### Operating systems tested on:

_No response_

<!-- gh-linked-prs -->
### Linked PRs
* gh-151514
<!-- /gh-linked-prs -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions