mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-119740: Remove deprecated trunc delegation (#119743)
Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`. --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
4aed319a8e
commit
f79ffc879b
11 changed files with 16 additions and 152 deletions
|
|
@ -225,6 +225,11 @@ Others
|
|||
It had previously raised a :exc:`DeprecationWarning` since Python 3.9. (Contributed
|
||||
by Jelle Zijlstra in :gh:`118767`.)
|
||||
|
||||
* The :func:`int` built-in no longer delegates to
|
||||
:meth:`~object.__trunc__`. Classes that want to support conversion to
|
||||
integer must implement either :meth:`~object.__int__` or
|
||||
:meth:`~object.__index__`. (Contributed by Mark Dickinson in :gh:`119743`.)
|
||||
|
||||
|
||||
Porting to Python 3.14
|
||||
======================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue