BUG: classobject.c

Adrian Eyre a.eyre at optichrome.com
Mon Oct 11 06:29:38 EDT 1999


> The PyObject_* APIs return object references with incremented refcount.
> You don't need the Py_INCREF here -- it would cause a memory leak.

Well. All I know is that the result of the PyObject_GetAttrString is
returning an object with a refcount of 1. And since PyString_AS_STRING
returns a pointer within the PyStringObject struct, then the
Py_XDECREF causes this to become invalid. Perhaps the Py_XDECREF should
be moved down to the line before the return.

Perhaps I've done something wrong. But I'm not sure how. If the
refcount is one, it tends to suggest that this is a new reference.
(i.e. the object didn't exist previously.) Do all PyMethodObjects
have an attribute called '__name__'?

--------------------------------------------
Adrian Eyre <mailto:a.eyre at optichrome.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233  Fax: +44 1483 760 644
http://www.optichrome.com 
--------------------------------------------





More information about the Python-list mailing list