[issue43824] array.array.__deepcopy__() accepts a parameter of any type

Josh Rosenberg report at bugs.python.org
Mon Apr 12 23:56:40 EDT 2021


Josh Rosenberg <shadowranger+python at gmail.com> added the comment:

__deepcopy__ is required to take a second argument by the rules of the copy module; the second argument is supposed to be a memo dictionary, but there's no reason to use it for array.array (it can't contain Python objects, and you only use the memo dictionary when recursing to Python objects you contain).

Sure, the second argument isn't being type-checked, but it's not used at all, and it's only supposed to be invoked indirectly via copy.deepcopy (that passes a dict).

Can you explain what is wrong here that needs to be fixed? Seems like a straightforward "protocol requires argument, but use case doesn't have anything to do with it, so it ignores it". Are you suggesting adding type-checks for something that never gets used?

----------
nosy: +josh.r

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43824>
_______________________________________


More information about the Python-bugs-list mailing list