Sequence Protocol, assign item

Michael Hudson mwh at python.net
Fri Sep 3 10:46:03 EDT 2004


Torsten Mohr <tmohr at s.netic.de> writes:

> Hi everybody,
> 
> at the moment i try to write an extension module in C
> and i implement the sequence protocol for the data type
> i created.  Reading values works fine.
> 
> But assigning a value does not work correctly, has anybody
> got an example for that?
> 
> The function type i have to create is intobjargproc, so
> i need to return an "int".  Returning 0 or 1 does not seem
> to work.
> 
> What can the return value be, what can i return her in case
> of failure and in case od success?
> 
> I don't use any INCREF or DECREF inside my function, do i need
> to do that for some parameters?  The exact error message i
> don't have available at the moment, i'll bring that one tomorrow,
> but it looks to me that at the cleanup at the end of the script
> an exception is thrown somewhere.

I suggest you look at the implementation of, say, lists in the Python
source distribution (Objects/listobject.c).

This is another way of saying I don't remember the answer to your
question :-)

Cheers,
mwh

-- 
  <shapr> ucking keyoar
                                                -- from Twisted.Quotes



More information about the Python-list mailing list