Author seberg
Recipients Alexander.Belopolsky, Arfrever, Christian.Tismer, Robin.Schreiber, amaury.forgeotdarc, belopolsky, haberman2, jcea, jhaberman, lekma, loewis, mattip, petr.viktorin, pitrou, seberg, steve.dower
Date 2021-09-23.17:58:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632419907.83.0.887542831426.issue15870@roundup.psfhosted.org>
In-reply-to
Content
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...
History
Date User Action Args
2021-09-23 17:58:27sebergsetrecipients: + seberg, loewis, jcea, amaury.forgeotdarc, belopolsky, pitrou, Arfrever, petr.viktorin, lekma, Alexander.Belopolsky, mattip, Robin.Schreiber, steve.dower, Christian.Tismer, jhaberman, haberman2
2021-09-23 17:58:27sebergsetmessageid: <1632419907.83.0.887542831426.issue15870@roundup.psfhosted.org>
2021-09-23 17:58:27seberglinkissue15870 messages
2021-09-23 17:58:27sebergcreate