On 25 August 2010 17:21, Carl Witty <[email protected]> wrote:
> On Wed, Aug 25, 2010 at 12:15 PM, Stefan Behnel <[email protected]> wrote:
>> Lisandro Dalcin, 25.08.2010 20:28:
>>> When trying to cythonize my code using the -3 flag, I got many errors
>>> like the one below:
>>>
>>> Error converting Pyrex file to C:
>>> ------------------------------------------------------------
>>> ...
>>>      if not (<int>PetscInitializeCalled): return
>>>      if (<int>PetscFinalizeCalled): return
>>>      # deinstall custom error handler
>>>      ierr = PetscPopErrorHandlerPython()
>>>      if ierr != 0:
>>>          fprintf(stderr, "PetscPopErrorHandler() failed "
>>>                         ^
>>> ------------------------------------------------------------
>>>
>>> /u/dalcinl/Devel/petsc4py-dev/src/PETSc/PETSc.pyx:307:24: Unicode
>>> literals do not support coercion to C types other than Py_UNICODE.
>>
>> Right, the parser reads the literal as unicode string here before type
>> analysis figures out that it's really meant to be a bytes literal.
>>
>> This will be hard to change as recovering the original bytes literal is
>> impossible once it's converted to a unicode string (remember that you can
>> use arbitrary character escape sequences in the literal). So I'm leaning
>> towards keeping this as an error. After all, Unicode string literals is one
>> of the things that a user explicitly requests with the -3 switch.
>
> How about allowing it for ASCII literals and leaving it an error if
> there are any codepoints in the literal outside the 0-127 range?
>

Definitely +1, your proposal is better than mine :-)


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to