New issue 2342: [cpyext] unable to set tp_as_* function if NULL when 
PyType_Ready called
https://bitbucket.org/pypy/pypy/issues/2342/cpyext-unable-to-set-tp_as_-function-if

mattip:

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? 


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to