[New-bugs-announce] [issue22453] PyObject_REPR macro causes refcount leak

Chris Colbert report at bugs.python.org
Sun Sep 21 18:26:08 CEST 2014


New submission from Chris Colbert:

This is how the macro is defined in object.h:

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

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


PyObject_Repr returns a new reference, which is not released by the macro. 

This macro only seems to be used internally for error reporting in compile.c, so it's unlikely to be causing any pressing issues for the interpreter, but it may be biting some extension modules.

----------
components: Extension Modules, Interpreter Core
messages: 227219
nosy: Chris.Colbert
priority: normal
severity: normal
status: open
title: PyObject_REPR macro causes refcount leak
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22453>
_______________________________________


More information about the New-bugs-announce mailing list