summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-09-09 06:17:05 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-09-09 06:17:05 (GMT)
commit2412853f8e65f7c4359ebf59902ad2553589b908 (patch)
treeaebb566a44b270af74495836065973125bb9e89f /Objects
parent8a64d40949fdd6adf2a25559b50f0cc7c229ab1f (diff)
downloadcpython-2412853f8e65f7c4359ebf59902ad2553589b908.zip
cpython-2412853f8e65f7c4359ebf59902ad2553589b908.tar.gz
cpython-2412853f8e65f7c4359ebf59902ad2553589b908.tar.bz2
Fix escaping of non-ASCII characters.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index dd38ee3..c090e9b 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -541,6 +541,7 @@ PyObject *PyString_DecodeEscape(const char *s,
end = s + len;
while (s < end) {
if (*s != '\\') {
+ non_esc:
#ifdef Py_USING_UNICODE
if (recode_encoding && (*s & 0x80)) {
PyObject *u, *w;
@@ -656,8 +657,9 @@ PyObject *PyString_DecodeEscape(const char *s,
#endif
default:
*p++ = '\\';
- *p++ = s[-1];
- break;
+ s--;
+ goto non_esc; /* an arbitry number of unescaped
+ UTF-8 bytes may follow. */
}
}
if (p-buf < newlen)