Passing object arguments to C functions exposed to Python layer

Geoffrey Wilfart wilfartg at
Tue Dec 18 12:52:17 CET 2001


I have created a new object type as described in Python documentation,
that I use as a wrapper for a C structure.
The object is like :
typedef struct {
  my_c_struct my_struct;
} MyObject

I have then a "constructor" function, that creates a new MyObject and
initializes  the C structure. It returns the newly created object.
I use it from Python as: 

my_obj = open()

Then, I would like to "close" the object, i.e. delete the C structure,
and then deallocate it. However, if I use a call like:

close(my_obj), the "args" value is not "my_obj". 

Could someone tell me what I should do in this case ?

Thanks a lot.

More information about the Python-list mailing list