diff options
author | Zackery Spytz <zspytz@gmail.com> | 2022-02-03 01:43:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 11:43:25 +0200 |
commit | b4bd1e1422997de61faf506b4916e83013bc7d21 (patch) | |
tree | a6c3e97b10f04c4ca17f876c5c9cfa061d287a34 /Misc | |
parent | 7ffe7ba30fc051014977c6f393c51e57e71a6648 (diff) | |
download | cpython3-b4bd1e1422997de61faf506b4916e83013bc7d21.tar.gz |
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2022-01-30-18-23-08.bpo-44977.BQV_zS.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-01-30-18-23-08.bpo-44977.BQV_zS.rst b/Misc/NEWS.d/next/Core and Builtins/2022-01-30-18-23-08.bpo-44977.BQV_zS.rst new file mode 100644 index 0000000000..84c1191bdb --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-01-30-18-23-08.bpo-44977.BQV_zS.rst @@ -0,0 +1,3 @@ +The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. +Calling ``int(a)`` when ``type(a)`` implements :meth:`__trunc__` but not +:meth:`__int__` or :meth:`__index__` now raises a :exc:`DeprecationWarning`. |