Skip to content

Incomplete test coverage of PyNumber_ToBase #93884

Closed
@JustAnotherArchivist

Description

@JustAnotherArchivist

I discovered that the tests for PyNumber_ToBase only ever check one small int value's conversions. The function description and implementation makes it quite clear that the intent is to support arbitrary ints, as would be expected for a function working with Python ints. Tests should be added for some large negative and positive values in different bases to ensure that that's indeed the case and also for the PyNumber_Index conversion part.

(This has likely contributed to a bug in PyPy, namely that the function only accepts values in the int64_t range in PyPy: https://foss.heptapod.net/pypy/pypy/-/issues/3765)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions