gh-123309: Remove check for redefined memo entry in pickletools.dis() (GH-123374)

Such pickles are supported by the Unpickler even if the Pickler does not
produce them.
This commit is contained in:
Serhiy Storchaka 2024-08-31 16:21:49 +03:00 committed by GitHub
parent fc897fcc01
commit 5414b97ce2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 24 deletions

View file

@ -206,7 +206,7 @@ highest protocol among opcodes = 0
def test_no_mark(self):
self.check_dis_error(b'Nt.', '''\
0: N NONE
1: t TUPLE no MARK exists on stack
1: t TUPLE
''', 'no MARK exists on stack')
def test_put(self):
@ -221,26 +221,16 @@ highest protocol among opcodes = 4
''')
def test_put_redefined(self):
self.check_dis_error(b'Np1\np1\n.', '''\
self.check_dis(b'Np1\np1\nq\x01r\x01\x00\x00\x00\x94.', '''\
0: N NONE
1: p PUT 1
4: p PUT 1
''', 'memo key 1 already defined')
self.check_dis_error(b'Np1\nq\x01.', '''\
0: N NONE
1: p PUT 1
4: q BINPUT 1
''', 'memo key 1 already defined')
self.check_dis_error(b'Np1\nr\x01\x00\x00\x00.', '''\
0: N NONE
1: p PUT 1
4: r LONG_BINPUT 1
''', 'memo key 1 already defined')
self.check_dis_error(b'Np1\n\x94.', '''\
0: N NONE
1: p PUT 1
4: \\x94 MEMOIZE (as 1)
''', 'memo key None already defined')
7: q BINPUT 1
9: r LONG_BINPUT 1
14: \\x94 MEMOIZE (as 1)
15: . STOP
highest protocol among opcodes = 4
''')
def test_put_empty_stack(self):
self.check_dis_error(b'p0\n', '''\