New submission from Alexander Belopolsky <belopol...@users.sourceforge.net>:
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 ---------- components: Interpreter Core files: empty-set-pickle.diff keywords: patch messages: 108937 nosy: alexandre.vassalotti, belopolsky, pitrou priority: normal severity: normal stage: patch review status: open title: Reduce pickle size for an empty set type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file17804/empty-set-pickle.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9120> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com