[Python-checkins] python/dist/src/Python ast.c,1.1.2.57,1.1.2.58

nascheme at users.sourceforge.net nascheme at users.sourceforge.net
Sat Apr 2 21:00:39 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7231/Python

Modified Files:
      Tag: ast-branch
	ast.c 
Log Message:
Fix AST compiler handling of unicode literals (SF patch #1170272).


Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.57
retrieving revision 1.1.2.58
diff -u -d -r1.1.2.57 -r1.1.2.58
--- ast.c	2 Apr 2005 18:50:06 -0000	1.1.2.57
+++ ast.c	2 Apr 2005 19:00:35 -0000	1.1.2.58
@@ -2546,6 +2546,7 @@
 #else
 	PyObject *u, *v;
 	char *s, *t;
+	t = s = *sPtr;
 	/* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */
 	while (s < end && (*s & 0x80)) s++;
 	*sPtr = s;
@@ -2566,8 +2567,10 @@
 	char *p;
 	const char *end;
 	if (encoding == NULL) {
+	     	buf = s;
 		u = NULL;
 	} else if (strcmp(encoding, "iso-8859-1") == 0) {
+	     	buf = s;
 		u = NULL;
 	} else {
 		/* "\XX" may become "\u005c\uHHLL" (12 bytes) */
@@ -2667,15 +2670,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	if (unicode || Py_UnicodeFlag) {
-#if 0
-		/* XXX currently broken */
 		return decode_unicode(s, len, rawmode, encoding);
-#else
-		if (rawmode)
-			return PyUnicode_DecodeRawUnicodeEscape(s, len, NULL);
-		else
-			return PyUnicode_DecodeUnicodeEscape(s, len, NULL);
-#endif
 	}
 #endif
 	need_encoding = (encoding != NULL &&



More information about the Python-checkins mailing list