From d3de6030d4b6ff4b9dd98080bf6684a2e32537c5 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 12 Feb 2023 10:13:55 +0300 Subject: [PATCH 01/10] gh-101825: mention, that as_integer_ratio() output is normalized --- Doc/library/stdtypes.rst | 4 ++-- Lib/fractions.py | 5 ++--- Objects/clinic/floatobject.c.h | 10 ++++------ Objects/clinic/longobject.c.h | 7 +++---- Objects/floatobject.c | 10 ++++------ Objects/longobject.c | 7 +++---- 6 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 0ef03035a572e5..73b38d291c6113 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -602,7 +602,7 @@ class`. In addition, it provides a few more methods: .. method:: int.as_integer_ratio() - Return a pair of integers whose ratio is exactly equal to the original + Return a pair of integers whose ratio is equal to the original integer and with a positive denominator. The integer ratio of integers (whole numbers) is always the integer as the numerator and ``1`` as the denominator. @@ -624,7 +624,7 @@ class`. float also has the following additional methods. .. method:: float.as_integer_ratio() Return a pair of integers whose ratio is exactly equal to the - original float and with a positive denominator. Raises + original float, is in lowest terms and with a positive denominator. Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs. diff --git a/Lib/fractions.py b/Lib/fractions.py index 49a3f2841a2ed4..74b90143120db9 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -320,10 +320,9 @@ def is_integer(self): return self._denominator == 1 def as_integer_ratio(self): - """Return the integer ratio as a tuple. + """Return a pair of integers, whose ratio is equal to the original Fraction. - Return a tuple of two integers, whose ratio is equal to the - Fraction and with a positive denominator. + The ratio is in lowest terms and with a positive denominator. """ return (self._numerator, self._denominator) diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h index 6bc25a0a409f97..4ecbd5f5e479ab 100644 --- a/Objects/clinic/floatobject.c.h +++ b/Objects/clinic/floatobject.c.h @@ -173,12 +173,10 @@ PyDoc_STRVAR(float_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Return integer ratio.\n" +"Return a pair of integers, whose ratio is exactly equal to the original float.\n" "\n" -"Return a pair of integers, whose ratio is exactly equal to the original float\n" -"and with a positive denominator.\n" -"\n" -"Raise OverflowError on infinities and a ValueError on NaNs.\n" +"The ratio is in lowest terms and with a positive denominator. Raise\n" +"OverflowError on infinities and a ValueError on NaNs.\n" "\n" ">>> (10.0).as_integer_ratio()\n" "(10, 1)\n" @@ -327,4 +325,4 @@ float___format__(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=74bc91bb44014df9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=1a8a0ef8e3989944 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 206bffdd086a5c..35191da66935df 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -231,10 +231,9 @@ PyDoc_STRVAR(int_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Return integer ratio.\n" +"Return a pair of integers, whose ratio is equal to the original int.\n" "\n" -"Return a pair of integers, whose ratio is exactly equal to the original int\n" -"and with a positive denominator.\n" +"The ratio is in lowest terms and with a positive denominator.\n" "\n" ">>> (10).as_integer_ratio()\n" "(10, 1)\n" @@ -485,4 +484,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=e518fe2b5d519322 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a54a033e8082de9e input=a9049054013a1b77]*/ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 912b742f797d24..0a1d37a61b5868 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1546,12 +1546,10 @@ float_fromhex(PyTypeObject *type, PyObject *string) /*[clinic input] float.as_integer_ratio -Return integer ratio. +Return a pair of integers, whose ratio is exactly equal to the original float. -Return a pair of integers, whose ratio is exactly equal to the original float -and with a positive denominator. - -Raise OverflowError on infinities and a ValueError on NaNs. +The ratio is in lowest terms and with a positive denominator. Raise +OverflowError on infinities and a ValueError on NaNs. >>> (10.0).as_integer_ratio() (10, 1) @@ -1563,7 +1561,7 @@ Raise OverflowError on infinities and a ValueError on NaNs. static PyObject * float_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=65f25f0d8d30a712 input=e21d08b4630c2e44]*/ +/*[clinic end generated code: output=65f25f0d8d30a712 input=75db3b49d292f077]*/ { double self_double; double float_part; diff --git a/Objects/longobject.c b/Objects/longobject.c index 8293f133bed213..8a2d7cbdb45f94 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6020,10 +6020,9 @@ int_bit_count_impl(PyObject *self) /*[clinic input] int.as_integer_ratio -Return integer ratio. +Return a pair of integers, whose ratio is equal to the original int. -Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator. +The ratio is in lowest terms and with a positive denominator. >>> (10).as_integer_ratio() (10, 1) @@ -6035,7 +6034,7 @@ and with a positive denominator. static PyObject * int_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=e60803ae1cc8621a input=55ce3058e15de393]*/ +/*[clinic end generated code: output=e60803ae1cc8621a input=c60aa1da86b7a47b]*/ { PyObject *ratio_tuple; PyObject *numerator = long_long(self); From dc76383f22cc1ec2416d02cc549dcc61cd4d5211 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 12 Feb 2023 13:17:18 +0300 Subject: [PATCH 02/10] Update Doc/library/stdtypes.rst Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com> --- Doc/library/stdtypes.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 73b38d291c6113..a941292d4a5020 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -602,10 +602,8 @@ class`. In addition, it provides a few more methods: .. method:: int.as_integer_ratio() - Return a pair of integers whose ratio is equal to the original - integer and with a positive denominator. The integer ratio of integers - (whole numbers) is always the integer as the numerator and ``1`` as the - denominator. + Given an integer ``x``, ``x.as_integer_ratio()`` returns the tuple + ``(x, 1)``. .. versionadded:: 3.8 From 771db8738898c6342c563817dbe8d589a6985cd4 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 12 Feb 2023 13:21:19 +0300 Subject: [PATCH 03/10] Slightly adjust above suggestion and do same for the docstring --- Doc/library/stdtypes.rst | 3 +-- Objects/clinic/longobject.c.h | 6 ++---- Objects/longobject.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a941292d4a5020..2558538135cf0e 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -602,8 +602,7 @@ class`. In addition, it provides a few more methods: .. method:: int.as_integer_ratio() - Given an integer ``x``, ``x.as_integer_ratio()`` returns the tuple - ``(x, 1)``. + Given an int ``x``, return the tuple ``(x, 1)``. .. versionadded:: 3.8 diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 35191da66935df..64bad4609ae9d2 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -231,9 +231,7 @@ PyDoc_STRVAR(int_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Return a pair of integers, whose ratio is equal to the original int.\n" -"\n" -"The ratio is in lowest terms and with a positive denominator.\n" +"Given an int x, return the tuple (x, 1).\n" "\n" ">>> (10).as_integer_ratio()\n" "(10, 1)\n" @@ -484,4 +482,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=a54a033e8082de9e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c605329a5c582559 input=a9049054013a1b77]*/ diff --git a/Objects/longobject.c b/Objects/longobject.c index 8a2d7cbdb45f94..5bbfe6f0015c5a 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6020,9 +6020,7 @@ int_bit_count_impl(PyObject *self) /*[clinic input] int.as_integer_ratio -Return a pair of integers, whose ratio is equal to the original int. - -The ratio is in lowest terms and with a positive denominator. +Given an int x, return the tuple (x, 1). >>> (10).as_integer_ratio() (10, 1) @@ -6034,7 +6032,7 @@ The ratio is in lowest terms and with a positive denominator. static PyObject * int_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=e60803ae1cc8621a input=c60aa1da86b7a47b]*/ +/*[clinic end generated code: output=e60803ae1cc8621a input=773adde26ef0a5c3]*/ { PyObject *ratio_tuple; PyObject *numerator = long_long(self); From 19738a717f76120598b68c6e94c0ae49cf75f473 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 13 Feb 2023 07:58:18 +0300 Subject: [PATCH 04/10] +1 (to cover bool, for instance) --- Doc/library/stdtypes.rst | 2 +- Objects/clinic/longobject.c.h | 4 ++-- Objects/longobject.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 2558538135cf0e..f4c0f7403a244c 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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)``. .. versionadded:: 3.8 diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 64bad4609ae9d2..7073d61536d164 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -231,7 +231,7 @@ PyDoc_STRVAR(int_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Given an int x, return the tuple (x, 1).\n" +"Given an integer x, return the tuple (int(x), 1).\n" "\n" ">>> (10).as_integer_ratio()\n" "(10, 1)\n" @@ -482,4 +482,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=c605329a5c582559 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ab356b117be2e104 input=a9049054013a1b77]*/ diff --git a/Objects/longobject.c b/Objects/longobject.c index 5bbfe6f0015c5a..88342ae79f3b80 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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() (10, 1) @@ -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); From 0aeb33afd44258ca62a342f3c64417b9b365285a Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 13 Feb 2023 07:59:24 +0300 Subject: [PATCH 05/10] Lets not test a patience of the reader with examples for this... --- Objects/clinic/longobject.c.h | 11 ++--------- Objects/longobject.c | 9 +-------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 7073d61536d164..5fc310768bd4ba 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -231,14 +231,7 @@ PyDoc_STRVAR(int_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Given an integer x, return the tuple (int(x), 1).\n" -"\n" -">>> (10).as_integer_ratio()\n" -"(10, 1)\n" -">>> (-10).as_integer_ratio()\n" -"(-10, 1)\n" -">>> (0).as_integer_ratio()\n" -"(0, 1)"); +"Given an integer x, return the tuple (int(x), 1)."); #define INT_AS_INTEGER_RATIO_METHODDEF \ {"as_integer_ratio", (PyCFunction)int_as_integer_ratio, METH_NOARGS, int_as_integer_ratio__doc__}, @@ -482,4 +475,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=ab356b117be2e104 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=1ee121cbd8c96cd2 input=a9049054013a1b77]*/ diff --git a/Objects/longobject.c b/Objects/longobject.c index 88342ae79f3b80..020af594d91518 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6021,18 +6021,11 @@ int_bit_count_impl(PyObject *self) int.as_integer_ratio Given an integer x, return the tuple (int(x), 1). - ->>> (10).as_integer_ratio() -(10, 1) ->>> (-10).as_integer_ratio() -(-10, 1) ->>> (0).as_integer_ratio() -(0, 1) [clinic start generated code]*/ static PyObject * int_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=e60803ae1cc8621a input=61de2d707e10af00]*/ +/*[clinic end generated code: output=e60803ae1cc8621a input=258f5b08307e7dcd]*/ { PyObject *ratio_tuple; PyObject *numerator = long_long(self); From f04dc7b9b86adfecca5d86c8b1a897add358ed23 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 13 Feb 2023 09:05:19 +0300 Subject: [PATCH 06/10] Amend 0aeb33afd4 --- Lib/test/test_doctest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index 65e215f1cdda4a..376f9fe36a5b42 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -711,7 +711,7 @@ def non_Python_modules(): r""" True >>> real_tests = [t for t in tests if len(t.examples) > 0] >>> len(real_tests) # objects that actually have doctests - 14 + 13 >>> for t in real_tests: ... print('{} {}'.format(len(t.examples), t.name)) ... @@ -723,7 +723,6 @@ def non_Python_modules(): r""" 2 builtins.float.hex 1 builtins.hex 1 builtins.int - 3 builtins.int.as_integer_ratio 2 builtins.int.bit_count 2 builtins.int.bit_length 5 builtins.memoryview.hex From 7892a40bf48f6ba2524a86d2358a7516145ad6d0 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 27 Feb 2023 07:11:38 +0300 Subject: [PATCH 07/10] Apply suggestions from code review Co-authored-by: Mark Dickinson --- Doc/library/stdtypes.rst | 2 +- Lib/fractions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f4c0f7403a244c..736f96d41343a9 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -621,7 +621,7 @@ class`. float also has the following additional methods. .. method:: float.as_integer_ratio() Return a pair of integers whose ratio is exactly equal to the - original float, is in lowest terms and with a positive denominator. Raises + original float. The ratio is in lowest terms and has a positive denominator. Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs. diff --git a/Lib/fractions.py b/Lib/fractions.py index 74b90143120db9..0456ae4e884853 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -322,7 +322,7 @@ def is_integer(self): def as_integer_ratio(self): """Return a pair of integers, whose ratio is equal to the original Fraction. - The ratio is in lowest terms and with a positive denominator. + The ratio is in lowest terms and has a positive denominator. """ return (self._numerator, self._denominator) From fdb47d277f3b374e23adc7f8d22f5427f5f1ae63 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 27 Feb 2023 07:25:14 +0300 Subject: [PATCH 08/10] Revert int.as_integer_ration() docstring/rst docs to the original patch --- Doc/library/stdtypes.rst | 5 ++++- Lib/test/test_doctest.py | 3 ++- Objects/clinic/longobject.c.h | 13 +++++++++++-- Objects/longobject.c | 13 +++++++++++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 1de7e91d403925..1240f80b0f11f0 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -602,7 +602,10 @@ class`. In addition, it provides a few more methods: .. method:: int.as_integer_ratio() - Given an integer ``x``, return the tuple ``(int(x), 1)``. + Return a pair of integers whose ratio is equal to the original + integer and has a positive denominator. The integer ratio of integers + (whole numbers) is always the integer as the numerator and ``1`` as the + denominator. .. versionadded:: 3.8 diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index 4c3d8ac404ec58..3491d4cdb1c18b 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -711,7 +711,7 @@ def non_Python_modules(): r""" True >>> real_tests = [t for t in tests if len(t.examples) > 0] >>> len(real_tests) # objects that actually have doctests - 13 + 14 >>> for t in real_tests: ... print('{} {}'.format(len(t.examples), t.name)) ... @@ -723,6 +723,7 @@ def non_Python_modules(): r""" 2 builtins.float.hex 1 builtins.hex 1 builtins.int + 3 builtins.int.as_integer_ratio 2 builtins.int.bit_count 2 builtins.int.bit_length 5 builtins.memoryview.hex diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 5fc310768bd4ba..c26ceafbc2be0d 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -231,7 +231,16 @@ PyDoc_STRVAR(int_as_integer_ratio__doc__, "as_integer_ratio($self, /)\n" "--\n" "\n" -"Given an integer x, return the tuple (int(x), 1)."); +"Return a pair of integers, whose ratio is equal to the original int.\n" +"\n" +"The ratio is in lowest terms and has a positive denominator.\n" +"\n" +">>> (10).as_integer_ratio()\n" +"(10, 1)\n" +">>> (-10).as_integer_ratio()\n" +"(-10, 1)\n" +">>> (0).as_integer_ratio()\n" +"(0, 1)"); #define INT_AS_INTEGER_RATIO_METHODDEF \ {"as_integer_ratio", (PyCFunction)int_as_integer_ratio, METH_NOARGS, int_as_integer_ratio__doc__}, @@ -475,4 +484,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=1ee121cbd8c96cd2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=cfdf35d916158d4f input=a9049054013a1b77]*/ diff --git a/Objects/longobject.c b/Objects/longobject.c index 020af594d91518..51655cd0bad9ec 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -6020,12 +6020,21 @@ int_bit_count_impl(PyObject *self) /*[clinic input] int.as_integer_ratio -Given an integer x, return the tuple (int(x), 1). +Return a pair of integers, whose ratio is equal to the original int. + +The ratio is in lowest terms and has a positive denominator. + +>>> (10).as_integer_ratio() +(10, 1) +>>> (-10).as_integer_ratio() +(-10, 1) +>>> (0).as_integer_ratio() +(0, 1) [clinic start generated code]*/ static PyObject * int_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=e60803ae1cc8621a input=258f5b08307e7dcd]*/ +/*[clinic end generated code: output=e60803ae1cc8621a input=384ff1766634bec2]*/ { PyObject *ratio_tuple; PyObject *numerator = long_long(self); From 31a94d0febcc4588858e037fd089e939789244bd Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 27 Feb 2023 08:16:29 +0300 Subject: [PATCH 09/10] Amend d3de6030d4 (correct fractions.rst) --- Doc/library/fractions.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index c61bbac892e0e4..fe2e8ab655edf8 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -118,7 +118,8 @@ another rational number, or from a string. .. method:: as_integer_ratio() Return a tuple of two integers, whose ratio is equal - to the Fraction and with a positive denominator. + to the original Fraction. The ratio is in lowest terms + and has a positive denominator. .. versionadded:: 3.8 From a2a84ae29fa2558590cf5252fae560052426815a Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 27 Feb 2023 08:17:23 +0300 Subject: [PATCH 10/10] Amend 7892a40bf4 (same nitpick for float) --- Objects/clinic/floatobject.c.h | 4 ++-- Objects/floatobject.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h index 4ecbd5f5e479ab..a99fd74e4b621b 100644 --- a/Objects/clinic/floatobject.c.h +++ b/Objects/clinic/floatobject.c.h @@ -175,7 +175,7 @@ PyDoc_STRVAR(float_as_integer_ratio__doc__, "\n" "Return a pair of integers, whose ratio is exactly equal to the original float.\n" "\n" -"The ratio is in lowest terms and with a positive denominator. Raise\n" +"The ratio is in lowest terms and has a positive denominator. Raise\n" "OverflowError on infinities and a ValueError on NaNs.\n" "\n" ">>> (10.0).as_integer_ratio()\n" @@ -325,4 +325,4 @@ float___format__(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=1a8a0ef8e3989944 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ea329577074911b9 input=a9049054013a1b77]*/ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 0a1d37a61b5868..d641311f1126cd 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1548,7 +1548,7 @@ float.as_integer_ratio Return a pair of integers, whose ratio is exactly equal to the original float. -The ratio is in lowest terms and with a positive denominator. Raise +The ratio is in lowest terms and has a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs. >>> (10.0).as_integer_ratio() @@ -1561,7 +1561,7 @@ OverflowError on infinities and a ValueError on NaNs. static PyObject * float_as_integer_ratio_impl(PyObject *self) -/*[clinic end generated code: output=65f25f0d8d30a712 input=75db3b49d292f077]*/ +/*[clinic end generated code: output=65f25f0d8d30a712 input=d5ba7765655d75bd]*/ { double self_double; double float_part;