C API and memory allocation

MRAB google at mrabarnett.plus.com
Thu Dec 18 15:19:15 CET 2008


Stefan Behnel wrote:
> Aaron Brady wrote:
>> I see.  Do I read correctly that 's' is only useful when the
>> argument's position is known?
> 
> I assume you meant "length".
> 
> 
>>  Otherwise you can't know its length or
>> change its reference count.
> 
> The internal representation of Python byte strings is 0 terminated, so
> strlen() will work.
> 
But remember that a bytestring can contain a zero byte (chr(0) in Python 
2.x).



More information about the Python-list mailing list