summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-10-26 15:19:44 (GMT)
committerGuido van Rossum <guido@python.org>1993-10-26 15:19:44 (GMT)
commit8054fad890bbb6668cb2eb2fb3118222bada5975 (patch)
tree787afe12459695c63d29abfca1fb111f918e0ba6 /Python/compile.c
parent546185075cbfde306021d8cbf913a1a575286eb0 (diff)
downloadcpython-8054fad890bbb6668cb2eb2fb3118222bada5975.zip
cpython-8054fad890bbb6668cb2eb2fb3118222bada5975.tar.gz
cpython-8054fad890bbb6668cb2eb2fb3118222bada5975.tar.bz2
Changes to accept double-quoted strings on input.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 2a1a2b4..685a806 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -481,13 +481,14 @@ parsestr(s)
char *buf;
char *p;
int c;
- if (*s != '\'') {
+ int quote = *s;
+ if (quote != '\'' && quote != '\"') {
err_badcall();
return NULL;
}
s++;
len = strlen(s);
- if (s[--len] != '\'') {
+ if (s[--len] != quote) {
err_badcall();
return NULL;
}
@@ -505,6 +506,7 @@ parsestr(s)
/* XXX This assumes ASCII! */
case '\\': *p++ = '\\'; break;
case '\'': *p++ = '\''; break;
+ case '\"': *p++ = '\"'; break;
case 'b': *p++ = '\b'; break;
case 'f': *p++ = '\014'; break; /* FF */
case 't': *p++ = '\t'; break;