New submission from Clint Hepner: Following a patch, a function's __defaults__ attribute is reset to None.
def foo(x=5): return x assert foo() == 5 # As expected with unittest.mock.patch.object(foo, '__defaults__', (10,)): assert foo() == 10 # As expected assert foo() == 5 # Fails assert foo.__defaults__ is None # Succeeds ---------- components: Library (Lib) messages: 224801 nosy: chepner priority: normal severity: normal status: open title: patch.object doesn't restore function defaults type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22138> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com