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
3cfcab95
Kaydet (Commit)
3cfcab95
authored
Ara 27, 2008
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue #4374: Pickle tests fail w/o _pickle extension.
Add an initialization check to mimic the interface of _pickle.
üst
44531cb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
pickle.py
Lib/pickle.py
+10
-0
No files found.
Lib/pickle.py
Dosyayı görüntüle @
3cfcab95
...
@@ -222,6 +222,11 @@ class _Pickler:
...
@@ -222,6 +222,11 @@ class _Pickler:
def
dump
(
self
,
obj
):
def
dump
(
self
,
obj
):
"""Write a pickled representation of obj to the open file."""
"""Write a pickled representation of obj to the open file."""
# Check whether Pickler was initialized correctly. This is
# only needed to mimic the behavior of _pickle.Pickler.dump().
if
not
hasattr
(
self
,
"write"
):
raise
PicklingError
(
"Pickler.__init__() was not called by "
"
%
s.__init__()"
%
(
self
.
__class__
.
__name__
,))
if
self
.
proto
>=
2
:
if
self
.
proto
>=
2
:
self
.
write
(
PROTO
+
bytes
([
self
.
proto
]))
self
.
write
(
PROTO
+
bytes
([
self
.
proto
]))
self
.
save
(
obj
)
self
.
save
(
obj
)
...
@@ -789,6 +794,11 @@ class _Unpickler:
...
@@ -789,6 +794,11 @@ class _Unpickler:
Return the reconstituted object hierarchy specified in the file.
Return the reconstituted object hierarchy specified in the file.
"""
"""
# Check whether Unpickler was initialized correctly. This is
# only needed to mimic the behavior of _pickle.Unpickler.dump().
if
not
hasattr
(
self
,
"read"
):
raise
UnpicklingError
(
"Unpickler.__init__() was not called by "
"
%
s.__init__()"
%
(
self
.
__class__
.
__name__
,))
self
.
mark
=
object
()
# any new unique object
self
.
mark
=
object
()
# any new unique object
self
.
stack
=
[]
self
.
stack
=
[]
self
.
append
=
self
.
stack
.
append
self
.
append
=
self
.
stack
.
append
...
...
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