Skip to content

Commit

Permalink
Revert workarounds in StdLib for Issue #52 (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp committed Mar 7, 2022
1 parent c352e65 commit 1d6b2c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
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

0 comments on commit 1d6b2c6

Please sign in to comment.