[Cython] char* and NULL in log statements

Johannes Wienke languitar at semipol.de
Thu Jun 5 00:02:53 CEST 2008


Am 06/04/2008 11:59 PM schrieb Dag Sverre Seljebotn:
> Johannes Wienke wrote:
>> Am 06/04/2008 07:47 PM schrieb Stefan Behnel:
>>> If you *really* want None, then you can use something like this:
>>>
>>>     cdef inline stringOrNone(char* value):
>>>          if value is NULL: return None
>>>          return value
>> That's exactly what I'm doing now but that's error-prone as you have to
>> do this manually and can forget it.
> 
> (Sorry about telling you to reread, I can see that you commented on it 
> already.)
> 
> Well, in my mind, this is a reason for supporting Stefan in removing 
> auto-coercion of char* to Python strings altogether (that is suggested 
> once down in those unicode discussion threads, right Stefan?). Then you 
> would get a nice compiler error when you forget it, and it won't be 
> error-prone.

Now with the context of encoding issues I can see the point. Things you 
don't have to think of to often as Java developer. ;) Removing the 
conversion then would be a good idea. Compiler warnings are of course 
the best bug prevention. On the other hand this really handy... Hard to 
decide.

- Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080605/6d167a1b/attachment.pgp 


More information about the Cython-dev mailing list