[New-bugs-announce] [issue9120] Reduce pickle size for an empty set
Alexander Belopolsky
report at bugs.python.org
Tue Jun 29 21:28:40 CEST 2010
New submission from Alexander Belopolsky <belopolsky at 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 <report at bugs.python.org>
<http://bugs.python.org/issue9120>
_______________________________________
More information about the New-bugs-announce
mailing list