summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-01-03 02:44:14 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-01-03 02:44:14 (GMT)
commitff72816b5fad9909c9e8ba4144d258b4595bbaca (patch)
tree01c2d2cb70e72fccac9da782333406474b6c14cf /Lib
parent426e052a4f60f94f3d97c95ce8477b967a975b3b (diff)
downloadcpython-ff72816b5fad9909c9e8ba4144d258b4595bbaca.zip
cpython-ff72816b5fad9909c9e8ba4144d258b4595bbaca.tar.gz
cpython-ff72816b5fad9909c9e8ba4144d258b4595bbaca.tar.bz2
Supply a reduce method for pickling.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/collections.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index f26c73e..89a1588 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -539,6 +539,9 @@ class Counter(dict):
'Like dict.copy() but returns a Counter instance instead of a dict.'
return Counter(self)
+ def __reduce__(self):
+ return self.__class__, (dict(self),)
+
def __delitem__(self, elem):
'Like dict.__delitem__() but does not raise KeyError for missing values.'
if elem in self: