Bug in Python/C API?
root at rainerdeyke.com
Mon Sep 11 20:33:28 CEST 2000
"Alex" <cut_me_out at hotmail.com> wrote in message
news:etd8zsysssw.fsf at oliver.mit.edu...
> >>>>> "Rainer" == Rainer Deyke <root at rainerdeyke.com> writes:
> Rainer> I noticed something very strange: when I use
> Rainer> PyObject_CallMethod to call a method on a class instance,
> Rainer> the method gets called twice. I am using Python version
> Rainer> 1.5.2.
> Could you post some code that does this?
Actually, I think I found the problem. I was doing this:
This of course executes the PyObject_CallMethod(...) twice if it did not
return 0 the first time.
I really should know better by now.
This sort of problem could be prevented if Py_XDECREF was defined like this:
#define Py_XDECREF(A) if (tmp = (A)) Py_DECREF(A)
where tmp is a global PyObject *.
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list