Writing a CPython extension - calling another sibbling method ?

Michael Torrie torriem at gmail.com
Tue Nov 19 11:00:26 EST 2019


On 11/19/19 1:09 AM, R.Wieser wrote:
> Michael
> 
>> Does this have to be done in the C API?
> 
> As far as I can tell, yes.  What I need to do is not exposed by the 
> extension itself, meaning that a wrapper class can't get access to it 
> either.

Sure but the Python methods themselves are exposed and accessible and
according to your previous posts, all you want to do is add an argument
to a call to the existing method.  If that's true, then you should be
able to do that part from pure Python.  The beauty of the C API is that
anything you define there should be visible and accessible from pure
Python world.

I can understand that the pure C stuff is not accessible of course. But
the snippets you've shown so far don't show any of that.

> And its just a syntax problem.  I currently simply have not enough knowledge 
> about the CPython API lanuages one to be able to even do a simple call ... 
> :-\

Are you able to post the C code, or at least enough of it that can
actually compile? It'd be much easier to help if we had something to
work with.  We're working in the dark here so it's difficult to know
exactly where to direct you.  It's always best on the list to work with
complete, standalone, minimal examples.

Looking at existing examples, as well as the C API documentation, are
how I figured out how to use it some years back when I needed to do a
small thing in C, although I've forgotten most of it now.


More information about the Python-list mailing list