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 scoder
Recipients lemburg, loewis, pitrou, scoder, skrah
Date 2014-08-28.17:56:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409248560.66.0.753009659406.issue22194@psf.upfronthosting.co.za>
In-reply-to
Content
> Stefan (Behnel), could you comment on the strategy that you had in mind?
> Is it similar to module_get_symbol.diff or entirely different?

I agree with Antoine that a Capsule would work better here (and yes, the performance problem of capsules is only with cases where they need to be unpacked frequently). Here is our current API for datetime as an example:

https://github.com/cython/cython/blob/e6c13f8922d6406f64f2578f5a0041e1615291a3/Cython/Includes/cpython/datetime.pxd

It's not great (it would be possible to make it look more OOP-ish), but it's simple and quite easy to use. The top of the file contains the necessary header declarations, and the rest are inline C wrapper functions that basically just rename the existing capsule C-API functions and macros to make them easily and nicely callable from Cython code without having to care about the Capsule and its list of C functions.

The declarations for _cdecimal would use a similar scheme and additionally include the libmpdec header declarations so that users could work with the underlying C data directly with a single (c-)import. That would then require the libmpdec symbols to be available, though, also when it's linked internally into _cdecimal.
History
Date User Action Args
2014-08-28 17:56:00scodersetrecipients: + scoder, lemburg, loewis, pitrou, skrah
2014-08-28 17:56:00scodersetmessageid: <1409248560.66.0.753009659406.issue22194@psf.upfronthosting.co.za>
2014-08-28 17:56:00scoderlinkissue22194 messages
2014-08-28 17:56:00scodercreate