diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 (GMT) |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 (GMT) |
commit | 835b243c71f5529da95aca5ca78fb9939278cffe (patch) | |
tree | 4ecc532040db92844d5dffc65f2edfce8fc6d449 /Objects/unicodeobject.c | |
parent | e3547fd2f7b8246113817841e55fe47556f3f41a (diff) | |
download | cpython-835b243c71f5529da95aca5ca78fb9939278cffe.zip cpython-835b243c71f5529da95aca5ca78fb9939278cffe.tar.gz cpython-835b243c71f5529da95aca5ca78fb9939278cffe.tar.bz2 |
Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'
just like string codecs.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 9e5e3b4..b850559 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1989,9 +1989,9 @@ PyObject *unicodeescape_string(const Py_UNICODE *s, while (size-- > 0) { Py_UNICODE ch = *s++; - /* Escape quotes */ - if (quotes && - (ch == (Py_UNICODE) PyString_AS_STRING(repr)[1] || ch == '\\')) { + /* Escape quotes and backslashes */ + if ((quotes && + ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { *p++ = '\\'; *p++ = (char) ch; continue; |