Skip to content

Prevent CO_FUTURE_BARRY_AS_BDFL from being applied with PyCF_MASK #123234

Open
@scw

Description

@scw

Bug report

Bug description:

When compiling Python strings with the PyCF_MASK, the CO_FUTURE_BARRY_AS_BDFL is included and will be applied to the statement. It would be preferable if the PEP 401 easter egg was not applied to code compiled with the PyCF_MASK compiler flag by default.

Example:

static const char code[] = "1 != 2";
static PyCompilerFlags compiler_flags = { PyCF_MASK | PyCF_SOURCE_IS_UTF8 };
PyObject* n = Py_CompileStringFlags(code, "<string>", Py_single_input, &compiler_flags);

Will result change the result to 1 <> 2.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions