mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Fix minor subclassing issue with collections.Counter
This commit is contained in:
commit
6c9e5b779f
3 changed files with 13 additions and 2 deletions
|
|
@ -536,8 +536,8 @@ class Counter(dict):
|
|||
self.subtract(kwds)
|
||||
|
||||
def copy(self):
|
||||
'Like dict.copy() but returns a Counter instance instead of a dict.'
|
||||
return Counter(self)
|
||||
'Return a shallow copy.'
|
||||
return self.__class__(self)
|
||||
|
||||
def __reduce__(self):
|
||||
return self.__class__, (dict(self),)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue