[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing a C extension - borrowed references

On 03/20/2018 10:03 AM, Tom Evans wrote:
> On Tue, Mar 20, 2018 at 4:38 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> BTW, have you looked into Cython? It's smart enough to take care of a
>> lot of this sort of thing for you.
> I did a bit; this work is to replace our old python 2 SAML client,
> which used python-lasso and python-libxml2, both packages that are
> built as part of building the C library and thus an utter PITA to
> package for different versions of python (something our Infra team
> were extremely reluctant to do). When the latest (PITA to build)
> version of python-lasso started interfering with python-xmlsec
> (validating an invalid signature was causing segfaults), I got fed up
> of fighting it.
> I actually also maintain a C version of the same code, using the same
> libraries, so porting those few segments of code to Python/C seemed
> more expedient than rewriting in Cython. I'm not writing an API to
> these libraries, just a few functions.
> Cheers
> Tom

If all you're doing is a thin-wrapper around a C library, have you 
thought about just using ctypes?

Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.