Sebastian Berg <sebast...@sipsolutions.net> added the comment:
I can make a PR from the patch (and add the `Py_tp_metaclass` slot if desired) with a basic test here, if that is what is blocking things. Fixing the type and size of the allocation (as the patch does) would allow me to give people a way to create a new NumPy DType dynamically. I only need the user to call my initialization function as soon as the type was created (with `PyType_FromSpec` or otherwise). (And I can avoid any internal acrobatics creating the type for the user; this stuff tends to be super confusing even if the principles are fairly straight forward...) Happy to pursue other avenues, but I am not clear which... > IIRC, mixing function pointers and data pointers doesn't work on some > platforms? ... I guess it is too late to do some weird thing like (not sure it would be reasonable or is valid anyway though): typedef union { void *pdata; void (*pfunc)(void); } slot_value; I am a bit interested in it, because I want to use a `FromSpec` API in NumPy and it would be nice to be sure I can grow it to include data without too much hassle. But the easier thing may just be to add one or two `void *reserved` slot to the spec struct that must be NULL for now... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue15870> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com