<mattip>
wrong analysis. The issue is that we have 3 types: app-level python "function",
<mattip>
rpython-level python function "builtin_function"
<mattip>
and c-api "builtin_function_or_method"
<mattip>
so a c-api function fails 'type(a) is types.BuiltinFunctionType'
<cfbolz>
:-(
<mattip>
if we wish 'type(a) is types.BuiltinFunctionType' to succeed for both a c-api function and something like len(),
<mattip>
we need to cheat somehow
<cfbolz>
mattip: we could probably cheat in pypy, because it's ok to have two different RPython classes that map to the same applevel class. eg we do that for W_IntObject and W_LongObject, which are both app-level type `int` in PyPy3. But's it's a bit of work
<cfbolz>
mattip: is that the cause of one of the issues?
<mattip>
I think so, I used the same version of numpy on both cpython and pypy and if I replace np.where for "a" a
<mattip>
above, I get the failure
<mattip>
in the 'types' module there is 'BuiltinFunctionType = type(len)'
<mattip>
issue 3025 checks equivalence 'type(np.where) is types.BuiltinFunctionType',
<mattip>
so the cheat would have to force type(len) and type(np.where) to be equivalent
<mattip>
ahh, indeed w_long inherits from w_int, "class W_AbstractLongObject(W_AbstractIntObject):"
Zaabtop has joined #pypy
<antocuni>
mattip: I think that the app-level type can be the same even if the rpython-type are unrelated
Zaabtop has quit [Client Quit]
jcea has quit [Remote host closed the connection]
jcea has joined #pypy
<mattip>
is it OK to change BuiltinFunction's typedef name from "builtin_function" to "builtin_function_or_method" ?
<mattip>
strange this is the first time this issue has surfaced
<antocuni>
why do you need to change the name?
<mattip>
for compliance with cpython
<mattip>
on cpython, type(len) -> "<type 'builtin_function_or_method'>"
<mattip>
on pypy, "<type 'builtin_function'>"
<antocuni>
ah I see
<antocuni>
and CPython doesn't have a "<type 'builtin_function'>" at all. I wonder why we chose to change the name then
<mattip>
maybe we started off the same then they changed it and we never caught up
<antocuni>
I think the reason is that in pypy, they are never actually used for methods
<antocuni>
e.g. type(dict.fromkeys), it's an instancemethod on pypy, a builtin_function_or_method on CPython
<antocuni>
so the "_or_method" part is basically a lie on PyPy; but still, I don't see why to introduce an unnecessary difference in the name