Repository navigation
COMPAT: PyPy calls clongdouble_int which raises a warning - #9181
Conversation
|
This feels like it's the
I would consider the fact that we modify the pointer after |
|
Note that after such a refactoring, the proposed patch would still be necessary, since now the call would raise a warning on both cpython and pypy :) The code in question is in src/umath/scalarmath.c.src, so to refactor it would mean moving all this to multiarray and calling before the call in multiarraymodule.c to setup_scalartypes. That is a large refactoring, worthy of a branch, since the code in question needs |
|
Seems like this test should just be calling
Why does |
|
There is consideration of moving the scalars back into the multiarray module, and maybe the rest of the ufunc machinery as well. That should be easier to do when One topic that probably needs a discussion and decision is whether to keep the ufuncs separate. There are two contradictory ideas out there regarding ufuncs. One is to generalize ufuncs to operate on buffers, essentially separating them from their current entanglement with |
|
Apropos the current PR, I agree wit @eric-wieser that the ideal solution is to use the correct function in the first place. The |
Even if we were going to go with the first idea, then I still think it would make sense to merge the two modules on disk; they could be logically separated at the API level and still share implementation details and be shipped together. (Of course I actually prefer the second idea anyway, because it seems to me that the main things users want are new dtypes and new storage strategies, and neither of those fit into the buffer paradigm.) |
|
Note that the failed test is a check for an "ignore" filter. You should use |
|
reworked, thanks for the comments. Not sure why it is showing commits other than b328445 |
I expect you merged the master branch. You can probably fix it by rebasing on master and doing a force push. |
|
Can we also add an |
|
Thanks @mattip . |
Python calls
x.tp_as_number.nb_intfor eitherint(x)orx.__int__(). However, if that function pointer is modified afterPyType_Ready, CPython will call the function registered whenPyType_Readyis called forx.__int__(), but the new function forint(x).In this case, the only difference between
clongdouble_int(the new function switched in duringadd_scalarmath()) andclongdoubletype_int(the original function duringPyType_Readyis that the latter one raises a Warning.On PyPy we always call the new function, so tests (and live code) that use
x.__int__()must accommodate for the warning. Code that callsint(x)will raise a warning on both platforms