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
69ab5836
Commit
69ab5836
authored
Nov 18, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Paul Rubin reminds me that of course a class's constructor /could/ get
called, if the pickler found a __getinitargs__() method.
parent
f376ef09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
Doc/lib/libpickle.tex
Doc/lib/libpickle.tex
+6
-4
No files found.
Doc/lib/libpickle.tex
View file @
69ab5836
...
...
@@ -604,10 +604,12 @@ evil things like call \code{os.unlink()} with an arbitrary file name.
See section~
\ref
{
pickle-protocol
}
for more details.
For safely unpickling class instances, you need to control exactly
which classes will get created. The issue here is usually not that a
class's constructor will get called --- it won't by the unpickler ---
but that the class's destructor (i.e. its
\method
{__
del
__
()
}
method)
might get called when the object is garbage collected. The way to
which classes will get created. Be aware that a class's constructor
could be called (if the pickler found a
\method
{__
getinitargs
__
()
}
method) and the the class's destructor (i.e. its
\method
{__
del
__
()
}
method)
might get called when the object is garbage collected. Depending on
the class, it isn't very heard to trick either method into doing bad
things, such as removing a file. The way to
control the classes that are safe to instantiate differs in
\module
{
pickle
}
and
\module
{
cPickle
}
\footnote
{
A word of caution: the
mechanisms described here use internal attributes and methods, which
...
...
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