summaryrefslogtreecommitdiff
path: root/Include/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/object.h')
-rw-r--r--Include/object.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Include/object.h b/Include/object.h
index 7584d4cdde..93062889a7 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -572,8 +572,12 @@ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
-/* Helper for passing objects to printf and the like */
-#define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj))
+#ifndef Py_LIMITED_API
+/* Helper for passing objects to printf and the like.
+ Leaks refcounts. Don't use it!
+*/
+#define PyObject_REPR(obj) PyUnicode_AsUTF8(PyObject_Repr(obj))
+#endif
/* Flag bits for printing: */
#define Py_PRINT_RAW 1 /* No string quotes etc. */