Skip to content

Commit

Permalink
Issue python#100: fix the test case test.test_pickler.SizeofTests.tes…
Browse files Browse the repository at this point in the history
…t_pickler

Adapt the test case to Stackless. Its C struct PicklerObject has an additional member.

https://bitbucket.org/stackless-dev/stackless/issues/100
  • Loading branch information
Anselm Kruis committed Nov 19, 2016
1 parent dad1337 commit 2e7e2f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Lib/test/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
except ImportError:
has_c_implementation = False

try:
import stackless
has_stackless = True
except ImportError:
has_stackless = False


class PickleTests(AbstractPickleModuleTests):
pass
Expand Down Expand Up @@ -146,7 +152,8 @@ class SizeofTests(unittest.TestCase):
check_sizeof = support.check_sizeof

def test_pickler(self):
basesize = support.calcobjsize('5P2n3i2n3iP')
basesize = support.calcobjsize('5P2n3i2n3iP' +
('P' if has_stackless else ''))
p = _pickle.Pickler(io.BytesIO())
self.assertEqual(object.__sizeof__(p), basesize)
MT_size = struct.calcsize('3nP0n')
Expand Down

0 comments on commit 2e7e2f7

Please sign in to comment.