This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients lemburg, pitrou, scoder, skrah
Date 2014-08-24.14:15:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <53F9F378.2010108@free.fr>
In-reply-to <20140824085606.GA11449@sleipnir.bytereef.org>
Content
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.
History
Date User Action Args
2014-08-24 14:15:26pitrousetrecipients: + pitrou, lemburg, scoder, skrah
2014-08-24 14:15:26pitroulinkissue22194 messages
2014-08-24 14:15:26pitroucreate