[pypy-issue] Issue #1832: Another misleading RPython error (pypy/pypy)

Edd Barrett issues-reply at bitbucket.org
Fri Aug 1 10:54:19 CEST 2014


New issue 1832: Another misleading RPython error
https://bitbucket.org/pypy/pypy/issue/1832/another-misleading-rpython-error

Edd Barrett:

Hi,

The following (artificially produced) error is misleading:

```
[translation:ERROR] TyperError: the following functions:
[translation:ERROR]     (hippy.interpreter:142)W_Globals._setitem_str
[translation:ERROR]     (hippy.module.pypy_bridge.php_wrappers:201)W_PyBridgeListProxy._setitem_str
[translation:ERROR]     (hippy.module.pypy_bridge.php_wrappers:289)W_PyBridgeDictProxy._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:269)W_ArrayObject._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:488)W_ListArrayObject._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:674)W_RDictArrayObject._setitem_str
[translation:ERROR] are called with inconsistent numbers of arguments
[translation:ERROR] sometimes with 3 arguments, sometimes with 4
[translation:ERROR] the callers of these functions are:
[translation:ERROR]     (hippy.interpreter:131)W_Globals.get_var
[translation:ERROR]     (hippy.objects.arrayobject:203)W_ArrayObject.setitem2_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:215)W_ArrayObject._setitem_ref
[translation:ERROR]     (hippy.objects.arrayobject:232)W_ArrayObject.packitem_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:501)W_ListArrayObject._convert_and_setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:671)W_RDictArrayObject._setitem_int
[translation:ERROR] the following functions:
[translation:ERROR]     (hippy.interpreter:142)W_Globals._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:674)W_RDictArrayObject._setitem_str
[translation:ERROR] are called with inconsistent numbers of arguments
[translation:ERROR] sometimes with 3 arguments, sometimes with 5
[translation:ERROR] the callers of these functions are:
[translation:ERROR]     (hippy.interpreter:131)W_Globals.get_var
[translation:ERROR]     (hippy.objects.arrayobject:203)W_ArrayObject.setitem2_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:215)W_ArrayObject._setitem_ref
[translation:ERROR]     (hippy.objects.arrayobject:232)W_ArrayObject.packitem_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:501)W_ListArrayObject._convert_and_setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:671)W_RDictArrayObject._setitem_int
[translation:ERROR] the following functions:
[translation:ERROR]     (hippy.interpreter:142)W_Globals._setitem_str
[translation:ERROR]     (hippy.module.pypy_bridge.php_wrappers:201)W_PyBridgeListProxy._setitem_str
[translation:ERROR]     (hippy.module.pypy_bridge.php_wrappers:289)W_PyBridgeDictProxy._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:269)W_ArrayObject._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:488)W_ListArrayObject._setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:674)W_RDictArrayObject._setitem_str
[translation:ERROR] are called with inconsistent numbers of arguments
[translation:ERROR] sometimes with 4 arguments, sometimes with 5
[translation:ERROR] the callers of these functions are:
[translation:ERROR]     (hippy.interpreter:131)W_Globals.get_var
[translation:ERROR]     (hippy.objects.arrayobject:203)W_ArrayObject.setitem2_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:215)W_ArrayObject._setitem_ref
[translation:ERROR]     (hippy.objects.arrayobject:232)W_ArrayObject.packitem_maybe_inplace
[translation:ERROR]     (hippy.objects.arrayobject:501)W_ListArrayObject._convert_and_setitem_str
[translation:ERROR]     (hippy.objects.arrayobject:671)W_RDictArrayObject._setitem_int
```

The problem has nothing to do with the number of arguments being passed. Rather, it is the name of the arguments that must match those of the superclass.

In the superclass `W_ArrayObject` we have:
```
def _setitem_str(self, key, w_value, as_ref, unique_array=False, unique_item=False):
```

Whereas in the subclass `W_PyBridgeDictProxy` we have:
```
def _setitem_str(self, bogus, w_value, as_ref, unique_array=False, unique_item=False):
```

Here `key != bogus` and this is the source of the crash, not # of arguments.

Is it possible to show a better message?




More information about the pypy-issue mailing list