File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -322,6 +322,20 @@ def test_newobj_list(self):
322322 self .assertEqual (x .__dict__ , y .__dict__ )
323323## import pickletools
324324## print
325+ ## pickletools.dis(s)
326+
327+ def test_newobj_list_slots (self ):
328+ x = SlotList ([1 , 2 , 3 ])
329+ x .foo = 42
330+ x .bar = "hello"
331+ s = self .dumps (x , 2 )
332+ y = self .loads (s )
333+ self .assertEqual (list (x ), list (y ))
334+ self .assertEqual (x .__dict__ , y .__dict__ )
335+ self .assertEqual (x .foo , y .foo )
336+ self .assertEqual (x .bar , y .bar )
337+ ## import pickletools
338+ ## print
325339## pickletools.dis(s)
326340
327341class MyTuple (tuple ):
@@ -330,6 +344,9 @@ class MyTuple(tuple):
330344class MyList (list ):
331345 pass
332346
347+ class SlotList (MyList ):
348+ __slots__ = ["foo" ]
349+
333350class AbstractPickleModuleTests (unittest .TestCase ):
334351
335352 def test_dump_closed_file (self ):
You can’t perform that action at this time.
0 commit comments