diff options
author | Brandt Bucher <brandt@python.org> | 2022-01-16 16:06:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-16 16:06:37 (GMT) |
commit | 5cd9a162cd02a3d0f1b0a182d80feeb17439e84f (patch) | |
tree | 3a80de2f3551e23f85f4c63200e5ecd844dfa374 /Lib/test/test_long.py | |
parent | 09087b8519316608b85131ee7455b664c00c38d2 (diff) | |
download | cpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.zip cpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.tar.gz cpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.tar.bz2 |
bpo-46361: Fix "small" `int` caching (GH-30583)
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r-- | Lib/test/test_long.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index f2a622b..c7dd0b2 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -1471,6 +1471,13 @@ class LongTest(unittest.TestCase): self.assertEqual(i, 1) self.assertEqual(getattr(i, 'foo', 'none'), 'bar') + @support.cpython_only + def test_from_bytes_small(self): + # bpo-46361 + for i in range(-5, 257): + b = i.to_bytes(2, signed=True) + self.assertIs(int.from_bytes(b, signed=True), i) + def test_access_to_nonexistent_digit_0(self): # http://bugs.python.org/issue14630: A bug in _PyLong_Copy meant that # ob_digit[0] was being incorrectly accessed for instances of a |