diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 +0000 |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2005-12-17 04:38:31 +0000 |
commit | c279865bdfc3633aee2835c88d53b5236a44b0dc (patch) | |
tree | 92a5c57980901a1defffd194fa8a7ec660ddf2fb /Objects | |
parent | 73ed2979cfec927461dfe942db44aef3da9d0a2d (diff) | |
download | cpython-c279865bdfc3633aee2835c88d53b5236a44b0dc.tar.gz |
Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'
just like string codecs.
Diffstat (limited to 'Objects')
-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 9e5e3b47a3..b85055929f 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; |