diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-18 22:08:38 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-18 22:08:38 (GMT) |
commit | 81f68a7d4b36be360b1dd28e6cbb49a43dc8937b (patch) | |
tree | f5f4ddb2c8e9f62dbaa5c81298d0d0407364360c /Include/object.h | |
parent | 60fe569673eecaffd4afccd9b4d8a2c2bb4df15e (diff) | |
download | cpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.zip cpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.tar.gz cpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.tar.bz2 |
Issue #22453: Warn against the use of leaking macro PyObject_REPR().
Diffstat (limited to 'Include/object.h')
-rw-r--r-- | Include/object.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Include/object.h b/Include/object.h index 7584d4c..9306288 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. */ |