Hugo Geoffroy added the comment:

This patch blacklists `__wrapped__` (using the same form as the first comment, 
with a more explicit exception message) in `unittest.mock._Call.__getattr__`. 

I also documented the change and added a tests that checks 
`assertFalse(hasattr(call, '__wrapped__'))`.

I did not make the same change in the `Mock` class, as its instances are not 
usually set at module level (which is what triggers this bug in doctests, as 
they run `inspect.unwrap` on module attributes).

I'd like to note that this regression can be nasty for some CI systems : it 
makes the Python interpreter infinitely allocate memory (as it's not a 
recursion error) and crashes any host that doesn't limit virtual memory 
allocation.

----------
keywords: +patch
nosy: +pstch
Added file: 
http://bugs.python.org/file44178/blacklist-wrapped-in-mock-call.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25532>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to