Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eb3f00ae
Commit
eb3f00ae
authored
Aug 14, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for trailing backslash. Fixes #593656.
parent
8a8da798
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
Lib/test/pickletester.py
Lib/test/pickletester.py
+1
-0
Objects/stringobject.c
Objects/stringobject.c
+8
-5
No files found.
Lib/test/pickletester.py
View file @
eb3f00ae
...
...
@@ -199,6 +199,7 @@ class AbstractPickleTests(unittest.TestCase):
"'abc"
,
# quote is not closed
"'abc
\
"
"
,
# open quote and close quote don't match
"'abc' ?"
,
# junk after close quote
"'
\
\
'"
,
# trailing backslash
# some tests of the quoting rules
#"'abc\"\''",
#"'\\\\a\'\'\'\\\'\\\\\''",
...
...
Objects/stringobject.c
View file @
eb3f00ae
...
...
@@ -546,6 +546,11 @@ PyObject *PyString_DecodeEscape(const char *s,
continue
;
}
s
++
;
if
(
s
==
end
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Trailing
\\
in string"
);
goto
failed
;
}
switch
(
*
s
++
)
{
/* XXX This assumes ASCII! */
case
'\n'
:
break
;
...
...
@@ -594,10 +599,9 @@ PyObject *PyString_DecodeEscape(const char *s,
break
;
}
if
(
!
errors
||
strcmp
(
errors
,
"strict"
)
==
0
)
{
Py_DECREF
(
v
);
PyErr_SetString
(
PyExc_ValueError
,
"invalid
\\
x escape"
);
return
NULL
;
goto
failed
;
}
if
(
strcmp
(
errors
,
"replace"
)
==
0
)
{
*
p
++
=
'?'
;
...
...
@@ -608,18 +612,17 @@ PyObject *PyString_DecodeEscape(const char *s,
"decoding error; "
"unknown error handling code: %.400s"
,
errors
);
return
NULL
;
goto
failed
;
}
#ifndef Py_USING_UNICODE
case
'u'
:
case
'U'
:
case
'N'
:
if
(
unicode
)
{
Py_DECREF
(
v
);
com_error
(
com
,
PyExc_ValueError
,
"Unicode escapes not legal "
"when Unicode disabled"
);
return
NULL
;
goto
failed
;
}
#endif
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment