[pypy-issue] Issue #2342: [cpyext] unable to set tp_as_* function if NULL when PyType_Ready called (pypy/pypy)
issues-reply at bitbucket.org
Sun Jul 10 10:39:54 EDT 2016
New issue 2342: [cpyext] unable to set tp_as_* function if NULL when PyType_Ready called
numpy sets tp_as_number slots for scalars when importing umath, which happens way after PyType_Ready is called on the scalar types. Since the various tp_as_number.* functions are NULL when PyType_Ready is called, no wrapper function is created in add_operators, and the later pto.tp_as_number assignment has no effect. This is the actual problem underlying issue #.
I have created a branch override-tp_as-methods and a test in that branch, but it is not clear to me what the strategy to resolve this should be. Two options, niether good::
- somehow create stub functions for each tp_as_* slot, wrapping the original type's function, beign careful not to create recursive calls
- add a PyPy only C_API function like PyType_Refresh(pto) that would re-assign the tp_as_* slots
Any other ideas?
More information about the pypy-issue