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

MingZhe Hu report at bugs.python.org
Tue Apr 13 04:34:04 EDT 2021


MingZhe Hu <humingzhework at 163.com> added the comment:

copy.deepcopy() takes a memo argument for reason, but this memo object will not be used when passed to array.array.__deepcopy__(), that is, no matter called directly or not, as long as the C implementation of array.array.__deepcopy__() does not use the parameter(s) passed from the Python side, why not declare it using flag `METH_NOARGS`?

If I understand right, in following code, the memo passed to __deepcopy__() is meaningless:

https://github.com/python/cpython/blob/a4833883c9b81b6b272cc7c5b67fa1658b65304c/Lib/copy.py#L151-L153

----------

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


More information about the Python-bugs-list mailing list