mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
d5d84c3f13
commit
ce76b547f9
5 changed files with 64 additions and 9 deletions
|
@ -443,6 +443,43 @@ highest protocol among opcodes = 0
|
|||
highest protocol among opcodes = 0
|
||||
''')
|
||||
|
||||
def test_constants(self):
|
||||
self.check_dis(b"(NI00\nI01\n\x89\x88t.", '''\
|
||||
0: ( MARK
|
||||
1: N NONE
|
||||
2: I INT False
|
||||
6: I INT True
|
||||
10: \\x89 NEWFALSE
|
||||
11: \\x88 NEWTRUE
|
||||
12: t TUPLE (MARK at 0)
|
||||
13: . STOP
|
||||
highest protocol among opcodes = 2
|
||||
''')
|
||||
|
||||
def test_integers(self):
|
||||
self.check_dis(b"(I0\nI1\nI10\nI011\nL12\nL13L\nL014\nL015L\nt.", '''\
|
||||
0: ( MARK
|
||||
1: I INT 0
|
||||
4: I INT 1
|
||||
7: I INT 10
|
||||
11: I INT 11
|
||||
16: L LONG 12
|
||||
20: L LONG 13
|
||||
25: L LONG 14
|
||||
30: L LONG 15
|
||||
36: t TUPLE (MARK at 0)
|
||||
37: . STOP
|
||||
highest protocol among opcodes = 0
|
||||
''')
|
||||
|
||||
def test_nondecimal_integers(self):
|
||||
self.check_dis_error(b'I0b10\n.', '', 'invalid literal for int')
|
||||
self.check_dis_error(b'I0o10\n.', '', 'invalid literal for int')
|
||||
self.check_dis_error(b'I0x10\n.', '', 'invalid literal for int')
|
||||
self.check_dis_error(b'L0b10L\n.', '', 'invalid literal for int')
|
||||
self.check_dis_error(b'L0o10L\n.', '', 'invalid literal for int')
|
||||
self.check_dis_error(b'L0x10L\n.', '', 'invalid literal for int')
|
||||
|
||||
|
||||
class MiscTestCase(unittest.TestCase):
|
||||
def test__all__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue