[pypy-issue] [issue944] Magic method exceptions

Gordon Ball tracker at bugs.pypy.org
Tue Nov 29 02:17:32 CET 2011


New submission from Gordon Ball <chronitis at gmail.com>:

Magic methods called directly handle exceptions differently to their operator
equivalents, eg

<pypy>
l = []
l += [1] #works
l.__iadd__([1]) #works
l += None #TypeError: unsupported operand type(s) for +: 'list' and 'NoneType'
l.__iadd__(None) #NotImplemented

<cpython>
l += None #TypeError
l.__iadd__(None) #TypeError

Presumably this is happening somewhere in the objectspace when multimethods are
being set up, but I'm afraid I can't work out where. (The cpython behaviour that
both should produce identical exceptions seems correct).

----------
messages: 3501
nosy: chronitis, pypy-issue
priority: bug
release: 1.7
status: unread
title: Magic method exceptions

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue944>
________________________________________


More information about the pypy-issue mailing list