summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2005-12-17 04:38:31 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2005-12-17 04:38:31 (GMT)
commit835b243c71f5529da95aca5ca78fb9939278cffe (patch)
tree4ecc532040db92844d5dffc65f2edfce8fc6d449 /Objects
parente3547fd2f7b8246113817841e55fe47556f3f41a (diff)
downloadcpython-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')
-rw-r--r--Objects/unicodeobject.c6
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;