I thought PY_NEW was to be avoided (except for classes overriding tp_new).
See https://trac.sagemath.org/ticket/17668 and 
https://github.com/cython/cython/wiki/FAQ#can-cython-create-objects-or-apply-operators-to-locally-created-objects-as-pure-c-code

On Sunday, April 8, 2018 at 9:41:17 AM UTC+2, vdelecroix wrote:
>
> Dear all, 
>
> What is the status of Integer.__new__(Integer) vs PY_NEW(Integer). One 
> can find both versions in the source code 
>
> $ grep -R "PY_NEW(Integer)" | wc -l 
> 152 
> $ grep -R "Integer.__new__(Integer)" | wc -l 
> 94 
>
> But the doc of PY_NEW (ext/stdsage.pxd) says that we should avoid the 
> second one 
>
>      Return ``t.__new__(t)``.  This works even for types like 
>      :class:`Integer` where we change ``tp_new`` at runtime (Cython 
>      optimizations assume that ``tp_new`` doesn't change). 
>
> Should I change the 94 bad usage? 
>
> Vincent 
>
> PS: this happen to be a question from 
> https://trac.sagemath.org/ticket/24717 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to