mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
Issue #22453: Warn against the use of leaking macro PyObject_REPR().
This commit is contained in:
parent
60fe569673
commit
81f68a7d4b
2 changed files with 16 additions and 12 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue