Re: [Cython] Python C-api ref count semantics

2011-02-17 Thread Stefan Behnel
Chris Colbert, 18.02.2011 03:23: What is the rule of thumb when declaring functions from python's C-api when comes to ref counting? The general rule is to not declare them yourself. Instead, cimport them from the cpython package. (See Cython/Includes/) If I define a test case like so: cde

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