summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2005-12-17 04:38:31 +0000
committerHye-Shik Chang <hyeshik@gmail.com>2005-12-17 04:38:31 +0000
commitc279865bdfc3633aee2835c88d53b5236a44b0dc (patch)
tree92a5c57980901a1defffd194fa8a7ec660ddf2fb /Objects
parent73ed2979cfec927461dfe942db44aef3da9d0a2d (diff)
downloadcpython-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.c6
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;