]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-100268: Add is_integer method to int (#100439)
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>
Sat, 24 Dec 2022 02:30:27 +0000 (20:30 -0600)
committerGitHub <noreply@github.com>
Sat, 24 Dec 2022 02:30:27 +0000 (18:30 -0800)
commit3e46f9fe05b40ee42009878620f448d3a4b44cb5
tree73a990d85dd392b93303c8fe98276029eef15f5b
parenta23cb72ac82372fac05ba36ce08923840ca0de06
gh-100268: Add is_integer method to int (#100439)

This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.
Doc/library/stdtypes.rst
Lib/test/test_long.py
Misc/NEWS.d/next/Core and Builtins/2022-12-22-21-56-08.gh-issue-100268.xw_phB.rst [new file with mode: 0644]
Objects/clinic/longobject.c.h
Objects/longobject.c