Say you define:
def f(*ts):
ts = (t for t in ts)
list(ts)
def g(*ts):
list(t for t in ts)
def h(*ts):
list((t for t in ts))
Then f(1,2,3) will fail with "Generator already executing" while g(1,2,3)
and h(1,2, 3) won't. All versions should work the same.
Cheers
--
Carlos
___
eneral criteria are discussed and adopted (for example, it
seems inconsistent to me doing this for cfunc and not for ccall).
Cheers
--
Carlos
[1] https://github.com/cython/cython/pull/459
On Fri, Oct 16, 2015 at 3:53 PM, Carlos Pita
wrote:
> Hi,
>
> in cython 0.24.0a0 this:
>
> --
>
> 3) cython.address will create a pointer from a list, another pointer or an
> instance of ArrayType (although, as I commented before: I see no
> compiler-compatible way to instantiate an ArrayType).
>
I just realized this is not an accurate description of what cython.address
does, but of what P
> keep pointers opaque... that would imply to remove __setitem__,
__getitem__,...
Probably I went too far there: at least ptr[0] could be kept as a
dereference operator.
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailma
ayType in a way that the compiler likes, so
I feel more inclined to remove it.
Sorry if I'm missing the point.
Cheers
--
Carlos
On Sun, Oct 18, 2015 at 2:45 PM, Carlos Pita
wrote:
> Hi,
>
> I'm in the process of refactoring the emulated types in Shadow, in order
>
Hi,
I'm in the process of refactoring the emulated types in Shadow, in order to
simplify a bit that part of the module. Ultimately I want to add support
for declaring typed memory views in pure python (currently it's only
possible to declare them as strings, Shadow does implement the slicing part
here. For example:
- Pointer base type cannot be a Python object (for ).
- Const base type cannot be a Python object (for ).
- Cannot cast to a function type (for ).
(the compiler dixit)
Cheers
--
Carlos
On Fri, Oct 16, 2015 at 4:05 PM, Carlos Pita
wrote:
> Hi,
>
> import
Hi,
import cython as cy
y = cy.cast('list', x)
fails to compile with "AttributeError: 'TypecastNode' object has no
attribute 'typecheck'".
But the following examples do compile:
y = x
y = cy.cast('int', x)
Cheers
--
Carlos
___
cython-devel mailing
Hi,
in cython 0.24.0a0 this:
--
import cython as cy
@cy.cfunc
def f(cats):
''.join(c for c in cats)
--
fails to compile with: Compiler crash in AnalyseDeclarationsTransform.
Nevertheless the following close variations do compile:
--
import cython as cy
@cy.cfunc
d
Something like:
cython.cast('object', x)
won't work because base_type will be None in ExprNodes.py:9323.
Here's is a simple fix, albeit I'm not sure the best one:
base_type = self.base_type.analyse(env) if self.base_type else py_object_type
Cheers
--
Carlos
___
> > Not sure, but would it be desirable for the decorators to be less dummy and
> > for RuntimeCompiledFunction to take the flags into account when compiling
> > on the fly?
>
> Can you provide a pull request, including tests?
I don't have much time these days but I gave some thoughts to this and
Hi all,
pure python mode will benefit from the addition of dummy decorators
for compiler directives to Shadow.py, like in:
@cython.boundscheck(False)
def f(): pass
AFAICS this is not currently valid inside the interpreter.
Cheers
--
Carlos
___
cython-
Hi all,
I've posted about this in the user list but after thinking about it a
bit more and doing some testing, I tend to believe it's a bug.
In the following code, the cython.double[:] in @cython.locals is not
recognized as a type, while g() compiles fine:
import cython
import scipy
@cython.loc
The problem seems to be that SliceIndexNode.analyse_as_type returns
just None, thus visit_FuncDefNode throws an error in the cython.locals
analysis part. Since a slice can be viewed as a type in the context of
cython.locals and cython.declare, analyse_as_type shouldn't return
None.
This is my firs
Hi all,
f and g below should behave identically, shouldn't them?
import cython
cdef struct Point:
int x
int y
def f():
return Point(x=10, y=10)
def g():
cdef Point p = Point(x=10, y=10)
return p
But then f won't compile:
Cannot interpret dict as type 'Python object'
Di
15 matches
Mail list logo