Skip to content

Useless code block in math.trunc() ? #111417

Closed
@skirpichev

Description

@skirpichev

Bug report

Bug description:

The math.trunc function has:

cpython/Modules/mathmodule.c

Lines 2073 to 2076 in f013b47

if (!_PyType_IsReady(Py_TYPE(x))) {
if (PyType_Ready(Py_TYPE(x)) < 0)
return NULL;
}

c.f. math.ceil or math.floor.

This seems to be a history artifact: the function was introduced in 400adb0 as a moved builtins.trunc(), while math.ceil/floor were here from the initial revision.

I think it's safe to remove mentioned block.

PS: Issue opened per @serhiy-storchaka suggestion in #110000.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-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