Skip to content

Revert workarounds in StdLib for Issue #52 #1333

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
merged 1 commit into from
Mar 7, 2022
Merged
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
1 change: 0 additions & 1 deletion Src/StdLib/Lib/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,4 +387,3 @@ def denominator(self):
return 1

Integral.register(int)
Integral.register(type(1 << 63)) # https://github.com/IronLanguages/ironpython3/issues/52
1 change: 0 additions & 1 deletion Src/StdLib/Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ def save_long(self, obj):
return
self.write(LONG + repr(obj).encode("ascii") + b'L\n')
dispatch[int] = save_long
dispatch[type(1 << 63)] = save_long # https://github.com/IronLanguages/ironpython3/issues/52

def save_float(self, obj):
if self.bin:
Expand Down
15 changes: 3 additions & 12 deletions Src/StdLib/Lib/test/test_long.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,21 +949,15 @@ def test_round(self):
got = round(10**k + 324678, -3)
expect = 10**k + 325000
self.assertEqual(got, expect)
if sys.implementation.name == "ironpython": # https://github.com/IronLanguages/ironpython3/issues/52
self.assertTrue(isinstance(got, int))
else:
self.assertIs(type(got), int)
self.assertIs(type(got), int)

# nonnegative second argument: round(x, n) should just return x
for n in range(5):
for i in range(100):
x = random.randrange(-10000, 10000)
got = round(x, n)
self.assertEqual(got, x)
if sys.implementation.name == "ironpython": # https://github.com/IronLanguages/ironpython3/issues/52
self.assertTrue(isinstance(got, int))
else:
self.assertIs(type(got), int)
self.assertIs(type(got), int)
for huge_n in 2**31-1, 2**31, 2**63-1, 2**63, 2**100, 10**100:
self.assertEqual(round(8979323, huge_n), 8979323)

Expand All @@ -972,10 +966,7 @@ def test_round(self):
x = random.randrange(-10000, 10000)
got = round(x)
self.assertEqual(got, x)
if sys.implementation.name == "ironpython": # https://github.com/IronLanguages/ironpython3/issues/52
self.assertTrue(isinstance(got, int))
else:
self.assertIs(type(got), int)
self.assertIs(type(got), int)

# bad second argument
bad_exponents = ('brian', 2.0, 0j)
Expand Down