Skip to content

curses window.getparent() is gated on unused ncurses extensions #154788

Description

@fedonman

Bug description:

window.getparent() is compiled only when the ncurses extension functions are present
(Modules/_cursesmodule.c:1854 guards the definition at :1875, and :4967 guards the
method table entry), but it calls no curses function:

    if (self->orig == NULL) {
        Py_RETURN_NONE;
    }
    return Py_NewRef((PyObject *)self->orig);

orig is set for every window (:1959), so the method works with any backend. Its
block-mates getdelay() and getscrreg() do call wgetdelay()/wgetscrreg() and need the
guard. The documentation states no availability requirement for getparent().

This matters now that curses can be built against the native curses of NetBSD and Solaris
(gh-136687). getparent() is new in 3.16 (gh-151776), so no released version is affected.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions