inveniosoftware / dojson

Simple pythonic JSON to JSON converter.
https://dojson.readthedocs.io
Other
10 stars 29 forks source link

utils: deepcopy() doesn't work on GroupableOrderedDict #167

Closed zazasa closed 8 years ago

zazasa commented 8 years ago

Look at this code:

In [44]: from dojson.contrib.marc21.utils import GroupableOrderedDict

In [45]: from copy import deepcopy

In [46]: deepcopy(GroupableOrderedDict([('a',1)]))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-46-034b040e27bb> in <module>()
----> 1 deepcopy(GroupableOrderedDict([('a',1)]))

/usr/local/lib/python3.5/copy.py in deepcopy(x, memo, _nil)
    164             copier = getattr(x, "__deepcopy__", None)
    165             if copier:
--> 166                 y = copier(memo)
    167             else:
    168                 reductor = dispatch_table.get(cls)

TypeError: __deepcopy__() takes 1 positional argument but 2 were given

It should depend on the override of the deepcopy function that does not accept the memo param: link