Skip to content

Skip tests exhausting the C stack based on the stack size, not the platform #155910

Description

@serhiy-storchaka

Feature or enhancement

96 skips in the test suite gate on the platform when what they actually mean is "the C stack here is too small for this test": 45 skip_wasi_stack_overflow(), 51 skip_emscripten_stack_overflow(), 4 hand-written "exhausts limited stack on WASI" skips and 3 skip_on_s390x. Their implementations say so outright:

def skip_wasi_stack_overflow():
    return unittest.skipIf(is_wasi, "Exhausts stack on WASI")

The condition is measurable, and half of the machinery already exists: _has_huge_c_stack(depth) asks _testinternalcapi.get_c_recursion_remaining(), and skip_if_huge_c_stack() skips when the stack is too large. The mirror predicate would replace all of the above.

The platform gates are wrong in both directions: a Linux machine with ulimit -s 512 is skipped by none of them, while a WASI build configured with a large stack is skipped by all of them.

Note that the estimate is derived from the size of the interpreter loop frame, so it is only a lower bound for recursion with smaller C frames (gh-155109). It says nothing at all about recursion which does not go through the eval loop, such as marshal's r_object().

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions