Re: [Cython] Gsoc project

2012-03-29 Thread Chris Colbert
Are you all aware of CWrap? It goes a long way to generating pxd files for a C libary. It can, for example, generate valid pxd files for the whole of the Intel IPP library. This would likely be a good launching point for a GSOC project, unless you really want to start from scratch. https://github

Re: [Cython] Speedup module-level lookup

2012-01-21 Thread Chris Colbert
On Sat, Jan 21, 2012 at 2:35 AM, Vitja Makarov wrote: > 2012/1/21 Stefan Behnel : > > Chris Colbert, 19.01.2012 09:18: > >> If it doesn't pass PyDict_CheckExact you won't be able to use it as the > >> globals to eval or exec. > > > > What makes yo

Re: [Cython] Speedup module-level lookup

2012-01-20 Thread Chris Colbert
On Fri, Jan 20, 2012 at 11:58 PM, Stefan Behnel wrote: > Chris Colbert, 19.01.2012 09:18: > > If it doesn't pass PyDict_CheckExact you won't be able to use it as the > > globals to eval or exec. > > What makes you say that? I tried and it worked for me, all the w

Re: [Cython] Speedup module-level lookup

2012-01-19 Thread Chris Colbert
If it doesn't pass PyDict_CheckExact you won't be able to use it as the globals to eval or exec. That's assuming you hack the module type so you can change its __dict__. On Jan 19, 2012 2:01 AM, "Robert Bradshaw" wrote: > On Wed, Jan 18, 2012 at 11:53 PM, Vitja Makarov > wrote: > > 2012/1/19 Vit

Re: [Cython] Speedup module-level lookup

2012-01-18 Thread Chris Colbert
AFAIK, a module's dict is readonly, so I don't believe a dict subclass will work there (I could be wrong) unless you hack up the module object from C. You can do it with descriptors on a ModuleType however, which should be plenty fast from Cython-land. In [16]: class AGetter(object): :

Re: [Cython] History of SWIG and applicability to Cython

2011-08-29 Thread Chris Colbert
I've been working on CWrap in my spare time. https://github.com/enthought/cwrap The goal is to be SWIG for Cython. It currently outputs pxd files for the headers of a C library. It's not mature, but it works. (It can output pxd files for the whole of Intel's IPP and MKL libraries). I hope to eve

Re: [Cython] How to define C-consts in python module scope

2011-07-18 Thread Chris Colbert
On Mon, Jul 18, 2011 at 12:14 PM, Lisandro Dalcin wrote: > On 18 July 2011 06:38, Vitja Makarov wrote: > > cdef enum: > > EV_READ = 1 > > EV_WRITE = 2 > > > > Is there a way to put this constants into module dict? > > I want to access this constants from pure python code, I tried this w

Re: [Cython] Fused types syntax

2011-06-02 Thread Chris Colbert
Not that my opinion carriers any weight, but I'm +1 on this. On Thu, Jun 2, 2011 at 11:39 AM, Robert Bradshaw < rober...@math.washington.edu> wrote: > In looking at merging fused types, it's time to nail down the syntax. > The current implementation is > >ctypedef cython.fused_type(list, dic

[Cython] Python C-api ref count semantics

2011-02-17 Thread Chris Colbert
What is the rule of thumb when declaring functions from python's C-api when comes to ref counting? If I define a test case like so: cdef extern from "Python.h": object PyWeakref_NewRef(object, object) object PyWeakref_GET_OBJECT(object) class Foo(object): pass cdef class Test:

Re: [Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-14 Thread Chris Colbert
On Mon, Feb 14, 2011 at 1:49 AM, Greg Ewing wrote: > Chris Colbert wrote: > >> The problem with delattr (and thus PyObject_DelAttr) arises when you >> define a __delattr__ method on your class. There is not easy way to then >> call back into the "normal" python

Re: [Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-14 Thread Chris Colbert
On Mon, Feb 14, 2011 at 1:50 AM, Greg Ewing wrote: > Chris Colbert wrote: > >> changing the include definition to: >> >> cdef extern from "Python.h": >> int PyObject_GenericSetAttr(PyObject*, PyObject*, PyObject*) except -1 >> > > This sugg

Re: [Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-13 Thread Chris Colbert
f'd before calling, so this may or not be an issue. On Sun, Feb 13, 2011 at 3:39 PM, Chris Colbert wrote: > I should mention, that these PyObject_Generic* functions are being used > from with __getattribute__, __setattr__, and __delattr__ methods. I should > have added that

Re: [Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-13 Thread Chris Colbert
I should mention, that these PyObject_Generic* functions are being used from with __getattribute__, __setattr__, and __delattr__ methods. I should have added that context in the begining. On Sun, Feb 13, 2011 at 3:37 PM, Chris Colbert wrote: > The problem with delattr (and thus PyObject_DelA

Re: [Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-13 Thread Chris Colbert
un, Feb 13, 2011 at 3:31 PM, Greg Ewing wrote: > Chris Colbert wrote: > >> I have cython file which is using PyObject_GenericSetAttr >> Now in my script I am using that function to generically delete an >> attribute by passing a NULL as the last value (this is proper way to t

[Cython] Bug in NULL handling introduced 0.14.1-1

2011-02-13 Thread Chris Colbert
I have cython file which is using PyObject_GenericSetAttr which is defined as follows in my pyx file: cdef extern from "Python.h": int PyObject_GenericSetAttr(object, object, object) except -1 Now in my script I am using that function to generically delete an attribute by passing a NULL as t