Re: [Tutor] Refcount in C extensions

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi Steve, Your remarks about Cython pushed me over the edge into the Unknown, this weekend I decided to download it and check it out. I've been using it the past few days and it totally rocks. It really feels like I was chained before and now I'm not; like where some simple Python operations coul

Re: [Tutor] Refcount in C extensions

2011-01-14 Thread Stefan Behnel
Izz ad-Din Ruhulessin, 14.01.2011 19:49: Thanks for your quick reply and clearing the issue up for me. Using your answer, I rewrote the function to this: double Py_GetAttr_DoubleFromFloat(PyObject *obj, const char *attr) { PyObject *get_attr, *py_float; int has_attr; //Check if the given

Re: [Tutor] Refcount in C extensions

2011-01-14 Thread Izz ad-Din Ruhulessin
Hi Stefan, Thanks for your quick reply and clearing the issue up for me. Using your answer, I rewrote the function to this: double Py_GetAttr_DoubleFromFloat(PyObject *obj, const char *attr) > > { > > PyObject *get_attr, *py_float; > > int has_attr; > > >> //Check if the given object has the give

Re: [Tutor] Refcount in C extensions

2011-01-14 Thread Stefan Behnel
Izz ad-Din Ruhulessin, 14.01.2011 17:52: I am writing a Python C extension and I have some trouble understanding how reference counting works exactly. Though I think I understand the practice on simple operations (see my question at stackoverflow: http://stackoverflow.com/questions/4657764/py-inc

[Tutor] Refcount in C extensions

2011-01-14 Thread Izz ad-Din Ruhulessin
Hello, I am writing a Python C extension and I have some trouble understanding how reference counting works exactly. Though I think I understand the practice on simple operations (see my question at stackoverflow: http://stackoverflow.com/questions/4657764/py-incref-decref-when), but on more "comp