On Sat, Oct 31, 2009 at 10:18 AM, Stefan Behnel <[email protected]> wrote:
>
> I think this is safe, but I wanted to mention it here so that others can
> give it another bit of thought.
>

Stefan, could you cythonize the line below:

cdef str s = str.__new__(str)

In the generated C code you will see a superfluous check "if(str is
None): raise TypeError()" ... Can you figure out why this is
happening?

BTW, this piece of code if far from being what CPython actually does :-) ...

  1064         elif type_arg.type_entry != obj.type_entry:
  1065             # different types - do what CPython does at runtime
  1066             error(type_arg.pos, "%s.__new__(%s) is not safe,
use %s.__new__()" %
  1067                   (obj.type_entry.name, type_arg.type_entry.name,
  1068                    type_arg.type_entry.name))
  1069             return node


-- 
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