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
d97da80d
Kaydet (Commit)
d97da80d
authored
Ock 28, 2003
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
save_tuple(): So long as the charter is rewriting for clarity, the snaky
control flow had to be simplified.
üst
ff57bff1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
pickle.py
Lib/pickle.py
+20
-21
No files found.
Lib/pickle.py
Dosyayı görüntüle @
d97da80d
...
@@ -458,27 +458,26 @@ class Pickler:
...
@@ -458,27 +458,26 @@ class Pickler:
def
save_tuple
(
self
,
object
):
def
save_tuple
(
self
,
object
):
write
=
self
.
write
write
=
self
.
write
save
=
self
.
save
memo
=
self
.
memo
proto
=
self
.
proto
proto
=
self
.
proto
if
proto
>=
1
:
n
=
len
(
object
)
n
=
len
(
object
)
if
n
==
0
and
proto
:
if
n
<=
3
:
write
(
EMPTY_TUPLE
)
if
not
object
:
return
write
(
EMPTY_TUPLE
)
return
save
=
self
.
save
if
proto
>=
2
:
memo
=
self
.
memo
for
element
in
object
:
if
n
<=
3
and
proto
>=
2
:
save
(
element
)
for
element
in
object
:
# Subtle. Same as in the big comment below.
save
(
element
)
if
id
(
object
)
in
memo
:
# Subtle. Same as in the big comment below.
get
=
self
.
get
(
memo
[
id
(
object
)][
0
])
if
id
(
object
)
in
memo
:
write
(
POP
*
n
+
get
)
get
=
self
.
get
(
memo
[
id
(
object
)][
0
])
else
:
write
(
POP
*
n
+
get
)
write
(
_tuplesize2code
[
n
])
else
:
self
.
memoize
(
object
)
write
(
_tuplesize2code
[
n
])
return
self
.
memoize
(
object
)
return
# proto 0, or proto 1 and tuple isn't empty, or proto > 1 and tuple
# proto 0, or proto 1 and tuple isn't empty, or proto > 1 and tuple
# has more than 3 elements.
# has more than 3 elements.
...
@@ -486,7 +485,7 @@ class Pickler:
...
@@ -486,7 +485,7 @@ class Pickler:
for
element
in
object
:
for
element
in
object
:
save
(
element
)
save
(
element
)
if
object
and
id
(
object
)
in
memo
:
if
n
and
id
(
object
)
in
memo
:
# Subtle. d was not in memo when we entered save_tuple(), so
# Subtle. d was not in memo when we entered save_tuple(), so
# the process of saving the tuple's elements must have saved
# the process of saving the tuple's elements must have saved
# the tuple itself: the tuple is recursive. The proper action
# the tuple itself: the tuple is recursive. The proper action
...
@@ -498,7 +497,7 @@ class Pickler:
...
@@ -498,7 +497,7 @@ class Pickler:
if
proto
:
if
proto
:
write
(
POP_MARK
+
get
)
write
(
POP_MARK
+
get
)
else
:
# proto 0 -- POP_MARK not available
else
:
# proto 0 -- POP_MARK not available
write
(
POP
*
(
len
(
object
)
+
1
)
+
get
)
write
(
POP
*
(
n
+
1
)
+
get
)
return
return
# No recursion (including the empty-tuple case for protocol 0).
# No recursion (including the empty-tuple case for protocol 0).
...
...
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