This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients alexandre.vassalotti, belopolsky, pitrou
Date 2010-06-29.19:28:37
SpamBayes Score 0.004602267
Marked as misclassified No
Message-id <1277839720.0.0.346517516652.issue9120@psf.upfronthosting.co.za>
In-reply-to
Content
Empty sets are pickled as set([]).  The pickle contains serialization of an empty list that is passed to set constructor during unpickling:

>>> dis(dumps(set()))
    0: \x80 PROTO      3
    2: c    GLOBAL     'builtins set'
   16: q    BINPUT     0
   18: ]    EMPTY_LIST
   19: q    BINPUT     1
   21: \x85 TUPLE1
   22: q    BINPUT     2
   24: R    REDUCE
   25: q    BINPUT     3
   27: .    STOP

The proposed patch pickles empty set as set() instead:


>>> dis(dumps(set()))
    0: \x80 PROTO      3
    2: c    GLOBAL     'builtins set'
   16: q    BINPUT     0
   18: )    EMPTY_TUPLE
   19: R    REDUCE
   20: q    BINPUT     1
   22: .    STOP
History
Date User Action Args
2010-06-29 19:28:40belopolskysetrecipients: + belopolsky, pitrou, alexandre.vassalotti
2010-06-29 19:28:40belopolskysetmessageid: <1277839720.0.0.346517516652.issue9120@psf.upfronthosting.co.za>
2010-06-29 19:28:38belopolskylinkissue9120 messages
2010-06-29 19:28:38belopolskycreate