diff Objects/unicodeobject.c @ 37267:d8de7500291d 2.4

after discussions with perky, reverted fix for Bug #1379994: Builtin unicode_escape and raw_unicode_escape codec now encodes backslash correctly. This caused another issue for unicode repr strings being double-escaped (SF Bug #1459029). Correct fix will be in 2.5, but is too risky for 2.4.3. Added a testcase for #1459029.
author Anthony Baxter <anthonybaxter@gmail.com>
date Tue, 28 Mar 2006 07:32:36 +0000
parents bc5161f292b7
children fea5d2fd9b8a
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Tue Mar 28 07:18:33 2006 +0000
+++ b/Objects/unicodeobject.c	Tue Mar 28 07:32:36 2006 +0000
@@ -1982,9 +1982,9 @@
     while (size-- > 0) {
         Py_UNICODE ch = *s++;
 
-        /* Escape quotes and backslashes */
-        if ((quotes &&
-	     ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') {
+        /* Escape quotes */
+        if (quotes &&
+	    (ch == (Py_UNICODE) PyString_AS_STRING(repr)[1] || ch == '\\')) {
             *p++ = '\\';
             *p++ = (char) ch;
 	    continue;