On Monday 27 March 2006 21:14, M.-A. Lemburg wrote:
Change PyObject_Repr() to use the default encoding (again) which is also consistent with how PyObject_Str() works.
For 2.4.3, I plan to just revert the following patch (and supply a test case) Index: Objects/object.c =================================================================== --- Objects/object.c (revision 16197) +++ Objects/object.c (revision 16198) @@ -267,7 +267,7 @@ return NULL; if (PyUnicode_Check(res)) { PyObject* str; - str = PyUnicode_AsEncodedString(res, NULL, NULL); + str = PyUnicode_AsUnicodeEscapeString(res); Py_DECREF(res); if (str) res = str; Does anyone have any objections to this? The test suite passes with this (including the new test) as do various random tests I could string together. I need to apply this in the next short while, so if you have an issue with it, please speak up now! Thanks, Anthony
To make repr() conversion more robust, we could have PyObject_Repr() apply the conversion using the 'replace' error strategy - after all, repr() is usually only used for debugging, where it's more important that you do get an output rather than an exception.
--
Anthony Baxter