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
cf117b0b
Kaydet (Commit)
cf117b0b
authored
Şub 09, 2003
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rename 'proto' keyword arg to 'protocol' . Greg Ward's suggestion.
üst
d58f3fce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
pickle.py
Lib/pickle.py
+17
-17
No files found.
Lib/pickle.py
Dosyayı görüntüle @
cf117b0b
...
@@ -167,11 +167,11 @@ del x
...
@@ -167,11 +167,11 @@ del x
class
Pickler
:
class
Pickler
:
def
__init__
(
self
,
file
,
proto
=
None
,
bin
=
None
):
def
__init__
(
self
,
file
,
proto
col
=
None
,
bin
=
None
):
"""This takes a file-like object for writing a pickle data stream.
"""This takes a file-like object for writing a pickle data stream.
The optional proto
argument tells the pickler to use the given
The optional proto
col argument tells the pickler to use the
protocol; supported protocols are 0, 1, 2. The default
given
protocol; supported protocols are 0, 1, 2. The default
protocol is 0, to be backwards compatible. (Protocol 0 is the
protocol is 0, to be backwards compatible. (Protocol 0 is the
only protocol that can be written to a file opened in text
only protocol that can be written to a file opened in text
mode and read back successfully. When using a protocol higher
mode and read back successfully. When using a protocol higher
...
@@ -191,22 +191,22 @@ class Pickler:
...
@@ -191,22 +191,22 @@ class Pickler:
object, or any other custom object that meets this interface.
object, or any other custom object that meets this interface.
"""
"""
if
proto
is
not
None
and
bin
is
not
None
:
if
proto
col
is
not
None
and
bin
is
not
None
:
raise
ValueError
,
"can't specify both 'proto
' and 'bin' arguments
"
raise
ValueError
,
"can't specify both 'proto
col' and 'bin'
"
if
bin
is
not
None
:
if
bin
is
not
None
:
warnings
.
warn
(
"The 'bin' argument to Pickler() is deprecated"
,
warnings
.
warn
(
"The 'bin' argument to Pickler() is deprecated"
,
PendingDeprecationWarning
)
PendingDeprecationWarning
)
proto
=
bin
proto
col
=
bin
if
proto
is
None
:
if
proto
col
is
None
:
proto
=
0
proto
col
=
0
if
proto
<
0
:
if
proto
col
<
0
:
proto
=
2
proto
col
=
2
elif
proto
not
in
(
0
,
1
,
2
):
elif
proto
col
not
in
(
0
,
1
,
2
):
raise
ValueError
,
"pickle protocol must be 0, 1 or 2"
raise
ValueError
,
"pickle protocol must be 0, 1 or 2"
self
.
write
=
file
.
write
self
.
write
=
file
.
write
self
.
memo
=
{}
self
.
memo
=
{}
self
.
proto
=
int
(
proto
)
self
.
proto
=
int
(
proto
col
)
self
.
bin
=
proto
>=
1
self
.
bin
=
proto
col
>=
1
self
.
fast
=
0
self
.
fast
=
0
def
clear_memo
(
self
):
def
clear_memo
(
self
):
...
@@ -1369,12 +1369,12 @@ try:
...
@@ -1369,12 +1369,12 @@ try:
except
ImportError
:
except
ImportError
:
from
StringIO
import
StringIO
from
StringIO
import
StringIO
def
dump
(
obj
,
file
,
proto
=
None
,
bin
=
None
):
def
dump
(
obj
,
file
,
proto
col
=
None
,
bin
=
None
):
Pickler
(
file
,
proto
,
bin
)
.
dump
(
obj
)
Pickler
(
file
,
proto
col
,
bin
)
.
dump
(
obj
)
def
dumps
(
obj
,
proto
=
None
,
bin
=
None
):
def
dumps
(
obj
,
proto
col
=
None
,
bin
=
None
):
file
=
StringIO
()
file
=
StringIO
()
Pickler
(
file
,
proto
,
bin
)
.
dump
(
obj
)
Pickler
(
file
,
proto
col
,
bin
)
.
dump
(
obj
)
return
file
.
getvalue
()
return
file
.
getvalue
()
def
load
(
file
):
def
load
(
file
):
...
...
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