Skip to content

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

Merged

Conversation

ZackerySpytz
Copy link
Contributor

@ZackerySpytz ZackerySpytz commented Jan 31, 2022

Calling int(a) when type(a) implements __trunc__ but not __int__ or __index__ now raises a DeprecationWarning.

https://bugs.python.org/issue44977

Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling
* The delegation of :class:`int` to :meth:`__trunc__` is now deprecated. Calling

Copy link
Member

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The delegation of :func:`int` to :meth:`__trunc__` is now deprecated.
The delegation of :class:`int` to :meth:`__trunc__` is now deprecated.

@serhiy-storchaka serhiy-storchaka merged commit b4bd1e1 into python:main Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants