Stefan, many, many thanks for your explanations. I believe I've
started to understand the whole beast. Please clarify me this:

Suppose I write this method in a pyx file:

def foo(char value[]): pass

and next call it (in a Py3 runtime env) in this two ways:

1-  foo(b"abc")

2-  foo("abc")

then (1) should be just fine, Cython should pass the raw C data as it
comes. But in the case of (2), will/should Cython (or at the Python C
API level) generate an error?

If the answer is NO, does it make sense to extend Cython with a C
'pseudotype' (ala bint), let call it 'bchar' to make the generated C
code being strict about the type of the Python-level argument?.




On 5/9/08, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> Hi again,
>
>  Stefan Behnel wrote:
>
> > Lisandro Dalcin wrote:
>  >> or even try to coerce the input to ascii 8-bits if the input is 'unicode'
>  >
>  > No, that's one of the problems why there is a lot of broken code in 
> Python2:
>
>
> Sorry, I misread your sentence here. You were asking how to fix your code and
>  I thought you meant Cython should do it for you (which it can't and also
>  shouldn't...)
>
>  If your input is unicode characters, then yes, encoding them to a well 
> defined
>  byte sequence is the right thing to do.
>
>
>  Stefan
>  _______________________________________________
>  Cython-dev mailing list
>  [email protected]
>  http://codespeak.net/mailman/listinfo/cython-dev
>


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to