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
32999ab4
Commit
32999ab4
authored
Jan 09, 2017
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #29190: Fixed possible errors in comparing strings in the pickle module.
parents
04c15d5b
f0f35a67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
Modules/_pickle.c
Modules/_pickle.c
+6
-12
No files found.
Modules/_pickle.c
View file @
32999ab4
...
@@ -1560,9 +1560,9 @@ memo_put(PicklerObject *self, PyObject *obj)
...
@@ -1560,9 +1560,9 @@ memo_put(PicklerObject *self, PyObject *obj)
}
}
static
PyObject
*
static
PyObject
*
get_dotted_path
(
PyObject
*
obj
,
PyObject
*
name
)
{
get_dotted_path
(
PyObject
*
obj
,
PyObject
*
name
)
{
_Py_static_string
(
PyId_dot
,
"."
);
_Py_static_string
(
PyId_dot
,
"."
);
_Py_static_string
(
PyId_locals
,
"<locals>"
);
PyObject
*
dotted_path
;
PyObject
*
dotted_path
;
Py_ssize_t
i
,
n
;
Py_ssize_t
i
,
n
;
...
@@ -1573,12 +1573,7 @@ get_dotted_path(PyObject *obj, PyObject *name) {
...
@@ -1573,12 +1573,7 @@ get_dotted_path(PyObject *obj, PyObject *name) {
assert
(
n
>=
1
);
assert
(
n
>=
1
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
PyObject
*
subpath
=
PyList_GET_ITEM
(
dotted_path
,
i
);
PyObject
*
subpath
=
PyList_GET_ITEM
(
dotted_path
,
i
);
PyObject
*
result
=
PyUnicode_RichCompare
(
if
(
_PyUnicode_EqualToASCIIString
(
subpath
,
"<locals>"
))
{
subpath
,
_PyUnicode_FromId
(
&
PyId_locals
),
Py_EQ
);
int
is_equal
=
(
result
==
Py_True
);
assert
(
PyBool_Check
(
result
));
Py_DECREF
(
result
);
if
(
is_equal
)
{
if
(
obj
==
NULL
)
if
(
obj
==
NULL
)
PyErr_Format
(
PyExc_AttributeError
,
PyErr_Format
(
PyExc_AttributeError
,
"Can't pickle local object %R"
,
name
);
"Can't pickle local object %R"
,
name
);
...
@@ -3549,12 +3544,11 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
...
@@ -3549,12 +3544,11 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
}
}
else
if
(
PyUnicode_Check
(
name
))
{
else
if
(
PyUnicode_Check
(
name
))
{
_Py_IDENTIFIER
(
__newobj_ex__
);
_Py_IDENTIFIER
(
__newobj_ex__
);
use_newobj_ex
=
PyUnicode_Compare
(
use_newobj_ex
=
_PyUnicode_EqualToASCIIId
(
name
,
_PyUnicode_FromId
(
&
PyId___newobj_ex__
))
==
0
;
name
,
&
PyId___newobj_ex__
)
;
if
(
!
use_newobj_ex
)
{
if
(
!
use_newobj_ex
)
{
_Py_IDENTIFIER
(
__newobj__
);
_Py_IDENTIFIER
(
__newobj__
);
use_newobj
=
PyUnicode_Compare
(
use_newobj
=
_PyUnicode_EqualToASCIIId
(
name
,
&
PyId___newobj__
);
name
,
_PyUnicode_FromId
(
&
PyId___newobj__
))
==
0
;
}
}
}
}
Py_XDECREF
(
name
);
Py_XDECREF
(
name
);
...
...
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