[issue22138] patch.object doesn't restore function defaults
Ezio Melotti
report at bugs.python.org
Wed Aug 6 11:18:50 CEST 2014
Ezio Melotti added the comment:
Thanks for the patch, however I don't think this is a robust solution.
Other objects might have undeletable attributes too.
The current code can delete an attribute without restoring it so an easy solution would be removing the hasattr() check, but that seems to be there to deal with proxy objects, so doing that will probably break them (Lib/unittest/test/testmock/testpatch.py:821 seems to test proxy object).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22138>
_______________________________________
More information about the Python-bugs-list
mailing list