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. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
