mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Changes to accept double-quoted strings on input.
This commit is contained in:
parent
546185075c
commit
8054fad890
2 changed files with 31 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue