Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a092ba1a
Kaydet (Commit)
a092ba1a
authored
Mar 21, 2003
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add PEP 307 section
üst
a978e106
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+44
-0
No files found.
Doc/whatsnew/whatsnew23.tex
Dosyayı görüntüle @
a092ba1a
...
@@ -883,6 +883,50 @@ by Kevin Altis, Dave Cole, Andrew McNamara, Skip Montanaro, Cliff Wells.
...
@@ -883,6 +883,50 @@ by Kevin Altis, Dave Cole, Andrew McNamara, Skip Montanaro, Cliff Wells.
\end{seealso}
\end{seealso}
%======================================================================
\section
{
PEP 307: Pickle Enhancements
\label
{
section-pep305
}}
The
\module
{
pickle
}
and
\module
{
cPickle
}
modules received some
attention during the 2.3 development cycle. In 2.2, new-style classes
could be pickled without difficult, but they weren't pickled very
compactly;
\pep
{
307
}
quotes a trivial example where a new-style class
results in a pickled string three times longer than that for a classic
class.
The solution was to invent a new pickle protocol. The
\function
{
pickle.dumps()
}
function has supported a text-or-binary flag
for a long time. In 2.3, this flag is redefined from a Boolean to an
integer; 0 is the old text-mode pickle format, 1 is the old binary
format, and now 2 is a new 2.3-specific format. (A new constant,
\constant
{
pickle.HIGHEST
_
PROTOCOL
}
, can be used to select the fanciest
protocol available.)
Unpickling is no longer considered a safe operation. 2.2's
\module
{
pickle
}
provided hooks for trying to prevent unsafe classes
from being unpickled (specifically, a
\member
{__
safe
_
for
_
unpickling
__}
attribute), but none of this code
was ever audited and therefore it's all been ripped out in 2.3. You
should not unpickle untrusted data in any version of Python.
To reduce the pickling overhead for new-style classes, a new interface
for customizing pickling was added using three special methods:
\method
{__
getstate
__}
,
\method
{__
setstate
__}
, and
\method
{__
getnewargs
__}
. Consult
\pep
{
307
}
for the full semantics
of these methods.
As a way to compress pickles yet further, it's now possible to use
integer codes instead of long strings to identify pickled classes.
The Python Software Foundation will maintain a list of standardized
codes; there's also a range of codes for private use. Currently no
codes have been specified.
\begin{seealso}
\seepep
{
307
}{
Extensions to the pickle protocol
}{
Written and implemented
by Guido van Rossum and Tim Peters.
}
\end{seealso}
%======================================================================
%======================================================================
\section
{
Extended Slices
\label
{
section-slices
}}
\section
{
Extended Slices
\label
{
section-slices
}}
...
...
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