Skip to content
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

gh-101825: mention, that as_integer_ratio() output is normalized #101843

Merged
merged 11 commits into from
Feb 27, 2023
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ class`. In addition, it provides a few more methods:

.. method:: int.as_integer_ratio()

Given an int ``x``, return the tuple ``(x, 1)``.
Given an integer ``x``, return the tuple ``(int(x), 1)``.
skirpichev marked this conversation as resolved.
Show resolved Hide resolved

.. versionadded:: 3.8

Expand Down
4 changes: 2 additions & 2 deletions Objects/clinic/longobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6020,7 +6020,7 @@ int_bit_count_impl(PyObject *self)
/*[clinic input]
int.as_integer_ratio

Given an int x, return the tuple (x, 1).
Given an integer x, return the tuple (int(x), 1).

>>> (10).as_integer_ratio()
skirpichev marked this conversation as resolved.
Show resolved Hide resolved
skirpichev marked this conversation as resolved.
Show resolved Hide resolved
(10, 1)
Expand All @@ -6032,7 +6032,7 @@ Given an int x, return the tuple (x, 1).

static PyObject *
int_as_integer_ratio_impl(PyObject *self)
/*[clinic end generated code: output=e60803ae1cc8621a input=773adde26ef0a5c3]*/
/*[clinic end generated code: output=e60803ae1cc8621a input=61de2d707e10af00]*/
{
PyObject *ratio_tuple;
PyObject *numerator = long_long(self);
Expand Down