[3.13] gh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__`` (GH-120088) by miss-islington · Pull Request #120197 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Lib/test/test_float.py
1 change: 0 additions & 1 deletion Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5412,7 +5412,6 @@ def test_builtins_have_signatures(self):
'bytearray': {'count', 'endswith', 'find', 'hex', 'index', 'rfind', 'rindex', 'startswith'},
'bytes': {'count', 'endswith', 'find', 'hex', 'index', 'rfind', 'rindex', 'startswith'},
'dict': {'pop'},
'int': {'__round__'},
'memoryview': {'cast', 'hex'},
'str': {'count', 'endswith', 'find', 'index', 'maketrans', 'rfind', 'rindex', 'startswith'},
}
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ def test_issue31619(self):
self.assertEqual(int('1_2_3_4_5_6_7_8_9', 16), 0x123456789)
self.assertEqual(int('1_2_3_4_5_6_7', 32), 1144132807)

def test_round_with_none_arg_direct_call(self):
for val in [(1).__round__(None),
round(1),
round(1, None)]:
self.assertEqual(val, 1)
self.assertIs(type(val), int)

class IntStrDigitLimitsTests(unittest.TestCase):

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Direct call to the :meth:`!int.__round__` now accepts ``None``
as a valid argument.
6 changes: 3 additions & 3 deletions Objects/clinic/longobject.c.h

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

6 changes: 3 additions & 3 deletions Objects/longobject.c