[Python-Dev] Inconsistency in 2.4.3 for repr() returning unicode (original) (raw)

Anthony Baxter anthony at interlink.com.au
Tue Mar 28 08:24:38 CEST 2006


On Monday 27 March 2006 21:14, M.-A. Lemburg wrote:

Change PyObjectRepr() to use the default encoding (again) which is also consistent with how PyObjectStr() 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;

NULL);

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 PyObjectRepr() 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 <anthony at interlink.com.au> It's never too late to have a happy childhood.



More information about the Python-Dev mailing list