mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Implemented proto 2 NEWTRUE and NEWFALSE in cPickle.
This commit is contained in:
parent
d156c2d782
commit
3c67d795ef
2 changed files with 40 additions and 2 deletions
|
@ -502,6 +502,12 @@ class AbstractPickleTests(unittest.TestCase):
|
|||
y = self.loads(s)
|
||||
self.assert_(x is y, (proto, x, s, y))
|
||||
|
||||
# Test that proto >= 2 really uses the bool opcodes.
|
||||
if proto >= 2 and x in (False, True):
|
||||
expected = x and pickle.NEWTRUE or pickle.NEWFALSE
|
||||
# Skip the PROTO opcode at the start.
|
||||
self.assertEqual(s[2], expected)
|
||||
|
||||
def test_newobj_tuple(self):
|
||||
x = MyTuple([1, 2, 3])
|
||||
x.foo = 42
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue