[Cython] Some bugs found while testing cython on django
Vitja Makarov
vitja.makarov at gmail.com
Mon Jun 20 10:00:01 CEST 2011
2011/6/20 Stefan Behnel <stefan_ml at behnel.de>:
> Vitja Makarov, 19.06.2011 21:37:
>>
>> Trying to compile django I've found some problems:
>>
>> 1. It seems that cython currently doesn't support tuples inside args
>> definition:
>>
>> def foo((a, b), c):
>>
>> Currently this gives missing argument name and crash inside
>> CreateControlFlow graph
>>
>> cython -X binding=True django/contrib/gis/forms/fields.py -o
>> django/contrib/gis/forms/fields.c
>
> It may be valid Py2-only syntax, but I consider its usage a bug in Django.
>
Ok. Any way I should fix crash in FlowControl.
>
>> 2. Concatenating unicode and str isn't supported:
>>
>> I guess that this is mostly django problem
>>
>> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> default_error_messages = {
>> 'no_geom' : _(u'No geometry value provided.'),
>> 'invalid_geom' : _(u'Invalid geometry value.'),
>> 'invalid_geom_type' : _(u'Invalid geometry type.'),
>> 'transform_error' : _(u'An error occurred when transforming
>> the geometry '
>> 'to the SRID of the geometry form field.'),
>> ^
>> ------------------------------------------------------------
>>
>> django/contrib/gis/forms/fields.py:21:30: Cannot mix string literals
>> of different types, expected u'', got ''
>
> That's a bug in Django. Worth submitting a patch to their bug tracker. It
> works in this case, but it's not what they want in their code:
>
> >>> u'abc\u1234'
> u'abc\u1234'
> >>> u'abc' '\u1234'
> u'abc\\u1234'
>
Ok.
--
vitja.
More information about the cython-devel
mailing list