Skip to content

PyFloat::py_new always return new float object even if the argument's oid is same. #3978

@jopemachine

Description

@jopemachine

Summary

PyFloat::py_new always return new float object even if the argument's oid is same.

Expected

>>> import math
>>> a = math.nan
>>> id(float(a))
4358871344
>>> a= math.nan
>>> id(float(a))
4358871344
>>> id(float(a))
4358871344
>>> id(float(a))
4358871344
>>> id(float(a))
4358871344

Actual

>>> import math
>>> a = math.nan
>>>>> id(float(a))
140470641517808
>>>>> id(float(a))
140470639935376
>>>>> id(float(a))
140470629849984
>>>>> id(float(a))
140470642896176
>>>>> id(float(a))
140470639935376

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-stdlibC-compatA discrepancy between RustPython and CPythonz-ca-2022Tag to track contrubution-academy 2022

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions