[Cython] [Bug] Generator already executing

2015-11-06 Thread Carlos Pita
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 ___

Re: [Cython] [Bug] Generator comprehension not compiling

2015-10-25 Thread Carlos Pita
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: > > --

Re: [Cython] [Refactor] Emulated types

2015-10-18 Thread Carlos Pita
> > 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

Re: [Cython] [Refactor] Emulated types

2015-10-18 Thread Carlos Pita
> 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

Re: [Cython] [Refactor] Emulated types

2015-10-18 Thread Carlos Pita
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 >

[Cython] [Refactor] Emulated types

2015-10-18 Thread Carlos Pita
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

Re: [Cython] [Bug] Unable to cast to python type.

2015-10-18 Thread Carlos Pita
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

[Cython] [Bug] Unable to cast to python type.

2015-10-16 Thread Carlos Pita
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

[Cython] [Bug] Generator comprehension not compiling

2015-10-16 Thread Carlos Pita
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

[Cython] [Bug] Cannot cython.cast to 'object'

2015-09-01 Thread Carlos Pita
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 ___

Re: [Cython] [RFE] Add dummy compiler directive decorators for pure python mode

2015-07-26 Thread Carlos Pita
> > 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

[Cython] [RFE] Add dummy compiler directive decorators for pure python mode

2015-04-07 Thread Carlos Pita
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-

[Cython] [Bug] Memoryviews in pure python mode

2015-04-05 Thread Carlos Pita
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

Re: [Cython] [Bug] Memoryviews in pure python mode

2015-04-05 Thread Carlos Pita
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

[Cython] [Bug] Coercion of struct constructor nodes

2015-04-05 Thread Carlos Pita
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