Skip to content

Missing whitespaces when using Py_CheckRecursiveCall & co #126035

Closed
@picnixz

Description

@picnixz

Bug report

Bug description:

The message must be prefixed by a whitespace since _Py_CheckRecursiveCall directly appends them to "maximum recursion depth exceeded":

cpython/Python/ceval.c

Lines 329 to 335 in dc76a4a

if (tstate->c_recursion_remaining <= 0) {
tstate->recursion_headroom++;
_PyErr_Format(tstate, PyExc_RecursionError,
"maximum recursion depth exceeded%s",
where);
tstate->recursion_headroom--;
++tstate->c_recursion_remaining;
.

Alternatively, we could make it so that a whitespace is automatically added and strip leading whitespaces if the "where" is the empty string (we wouldn't strip whitespaces in custom messages though I think).

For now, I'll just add the missing whitespaces where it should be.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions