Laurent De Buyst added the comment:
Sorry Michael, I should have read your second comment more closely since you
already pointed out that using a list as default argument is bad.
It is, however, easily fixed by changing to this:
def reset_mock(self, visited=None):
Restore the mock object
Laurent De Buyst added the comment:
And here's an actual patch with the corrected code
--
Added file: http://bugs.python.org/file33463/issue18622_2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18622
Laurent De Buyst added the comment:
The proposed patch does solve the infinite recursion bug, but a different
problem appears when resetting the same mock multiple times: it only works the
first time.
Using the patch as it stands:
from unittest.mock import mock_open
mo = mock_open