En Thu, 05 Apr 2007 03:35:34 -0300, lialie <[EMAIL PROTECTED]> escribió:

> I try to callback from a thread in C. But it collapsed. I can't figure
> it out.

- If you are using threads, you must handle the Global Interpreter Lock  
(GIL), see http://docs.python.org/api/threads.html

- You don't handle refcounts well:

         my_callback = temp;
         Py_XINCREF(temp);
         Py_XDECREF(my_callback);

The code above does nothing. You must decrement my_callback *before* the  
assignment (because you are about to lose a reference to the previous  
value) and increment it after (because you keep a reference to the new  
value).

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to