Antoine Pitrou added the comment:

Le 24/08/2014 04:56, Stefan Krah a écrit :
>
> I'm not sure about OS X, but I would be surprised if it did not work.
>
> To my limited knowledge, Capsules are slow, see also here (the penultimate
> paragraph):

They are slow if you have to lookup and unwrap a capsule every time you 
use it. But the way it would work for _decimal (and the way it already 
works for _datetime), AFAIK, would be different: you would look up the 
"capsule API structure" once and then simply dereference function 
pointers from that structure.

You can actually take a look at Include/datetime.h and see if the 
approach would work. See especially:

/* Define global variable for the C API and a macro for setting it. */
static PyDateTime_CAPI *PyDateTimeAPI = NULL;

#define PyDateTime_IMPORT \
     PyDateTimeAPI = (PyDateTime_CAPI 
*)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)

which encourages a once-in-a-process-lifetime API lookup pattern.
I don't think a hand-coded dlsym()-based approach can be any 
significantly faster.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22194>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to