[Checkins] [zopefoundation/Zope] 6ed0c1: Fix unpickling FuncCode instances

GitHub noreply at github.com
Mon Feb 13 04:43:03 CET 2017


  Branch: refs/heads/plonezope4
  Home:   https://github.com/zopefoundation/Zope
  Commit: 6ed0c1667e518fc912d9feef2855c549f1522f96
      https://github.com/zopefoundation/Zope/commit/6ed0c1667e518fc912d9feef2855c549f1522f96
  Author: David Glick <david at glicksoftware.com>
  Date:   2017-02-12 (Sun, 12 Feb 2017)

  Changed paths:
    M src/Shared/DC/Scripts/Signature.py

  Log Message:
  -----------
  Fix unpickling FuncCode instances

This used to be an old-style class, and the pickle calls the OBJ opcode
(which for old-style classes creates an instance without calling __init__)
and later the BUILD opcode which calls __setstate__. Now that the class
is new-style, the OBJ opcode calls __init__, which breaks because the
pickle doesn't include args for __init__. So the workaround here is to
make __init__ accept no args (the object dict will still get set by the
subsequent BUILD op). Once the new-style object gets re-pickled it will
use the NEWOBJ opcode instead of OBJ, so unpickling will only call __new__
and not __init__.




More information about the checkins mailing list