Message231328
> For the second part, you can use PySys_FormatStderr() which is more complex but more correct
PySys_FormatStderr() is more heavy function, it depends on working sys.stderr and codecs. Taking into account the lack of tests we should be careful with such changes. So I prefer to keep fprintf.
> Py_LIMITED_API is the "stable ABI". Most third-party code doesn't use it, so it may still use PyObject_REPR().
So we should just add a warning? This macro is not documented anywhere.
-/* 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 |
|
Date |
User |
Action |
Args |
2014-11-18 16:39:07 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, vstinner, Chris.Colbert |
2014-11-18 16:39:07 | serhiy.storchaka | set | messageid: <1416328747.15.0.0642642874263.issue22453@psf.upfronthosting.co.za> |
2014-11-18 16:39:07 | serhiy.storchaka | link | issue22453 messages |
2014-11-18 16:39:06 | serhiy.storchaka | create | |
|