-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-44977: Deprecate delegation of int to __trunc__ #31031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-44977: Deprecate delegation of int to __trunc__ #31031
Conversation
Calling int(a) when type(a) implements __trunc__ but not __int__ or __index__ now raises a DeprecationWarning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -458,6 +458,11 @@ Deprecated | |||
as deprecated, its docstring is now corrected). | |||
(Contributed by Hugo van Kemenade in :issue:`45837`.) | |||
|
|||
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling | |
* The delegation of :class:`int` to :meth:`__trunc__` is now deprecated. Calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int()
is referred as a function here, not a class.
The current text is correct.
@@ -0,0 +1,3 @@ | |||
The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. | |
The delegation of :class:`int` to :meth:`__trunc__` is now deprecated. |
Calling
int(a)
whentype(a)
implements__trunc__
but not__int__
or__index__
now raises a DeprecationWarning.https://bugs.python.org/issue44977