[Python-Dev] PyObject_REPR()

Thomas Wouters thomas at python.org
Wed Apr 12 01:04:22 CEST 2006


I hadn't noticed this macro defined in Include/object.h before:

/* Helper for passing objects to printf and the like */
#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj))

I may not be right, but I don't see how this can't help but not free the
intermediate PyString object. It doesn't seem to be used, except for in
situations where Python is not going to continue working much longer anyway
(specifically, in compile.c and ceval.c.) I could not be right about *that*,
too, though ;-) It strikes me that it should not be used, or maybe renamed
to _PyObject_REPR. It's wasn't added in 2.5 or 2.4, though, so it's not
particularly new and I can't guarantee that it's not used in any third party
code. But, then again, anyone using it isn't free of leaks. Should removing
or renaming it be done in 2.5 or in Py3K?

Triple-negative'ly y'rs,
--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060412/dadee382/attachment.htm 


More information about the Python-Dev mailing list