Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
persistent
Commits
6b57f2a8
Commit
6b57f2a8
authored
Feb 23, 2017
by
Adam Groszer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added error handling + reference counting
parent
25b52694
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
persistent/cPersistence.c
persistent/cPersistence.c
+27
-0
No files found.
persistent/cPersistence.c
View file @
6b57f2a8
...
...
@@ -632,20 +632,47 @@ pickle___setstate__(PyObject *self, PyObject *state)
fall back to iterating over items, instead of silently
failing with PyDict_Next */
items
=
PyMapping_Items
(
state
);
if
(
items
==
NULL
)
return
NULL
;
len
=
PySequence_Size
(
items
);
if
(
len
<
0
)
{
Py_DECREF
(
items
);
return
NULL
;
}
for
(
i
=
0
;
i
<
len
;
++
i
)
{
PyObject
*
item
=
PySequence_GetItem
(
items
,
i
);
if
(
item
==
NULL
)
return
NULL
;
d_key
=
PyTuple_GetItem
(
item
,
0
);
if
(
d_key
==
NULL
)
{
Py_DECREF
(
item
);
Py_DECREF
(
items
);
return
NULL
;
}
d_value
=
PyTuple_GetItem
(
item
,
1
);
if
(
d_value
==
NULL
)
{
Py_DECREF
(
d_key
);
Py_DECREF
(
item
);
Py_DECREF
(
items
);
return
NULL
;
}
if
(
NATIVE_CHECK_EXACT
(
d_key
))
{
Py_INCREF
(
d_key
);
INTERN_INPLACE
(
&
d_key
);
Py_DECREF
(
d_key
);
}
Py_DECREF
(
item
);
if
(
PyObject_SetItem
(
*
dict
,
d_key
,
d_value
)
<
0
)
{
Py_DECREF
(
items
);
return
NULL
;
}
}
Py_DECREF
(
items
);
}
}
...
...
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