[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

Karthikeyan Singaravelan report at bugs.python.org
Sat Mar 28 00:00:02 EDT 2020


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

> What may make more sense for some magic methods is to call the underlying object and use the return value or raise any exception that occurs.

Sorry, isn't that what the previous issue did? It tries to return the wrapped object attribute and raises exception if attribute is not present. Using wrapped object attribute and falling back to default value means that it will always return a value but the user can't figure out if it's from wrapped object or the default value for the magic method.

----------

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


More information about the Python-bugs-list mailing list