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
896414fe
Kaydet (Commit)
896414fe
authored
Kas 30, 2013
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed _pickle.Unpickler to handle empty persistent IDs correctly.
üst
1a83070d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
19 deletions
+26
-19
pickletester.py
Lib/test/pickletester.py
+22
-18
NEWS
Misc/NEWS
+3
-0
_pickle.c
Modules/_pickle.c
+1
-1
No files found.
Lib/test/pickletester.py
Dosyayı görüntüle @
896414fe
...
...
@@ -1499,30 +1499,34 @@ class AbstractPersistentPicklerTests(unittest.TestCase):
if
isinstance
(
object
,
int
)
and
object
%
2
==
0
:
self
.
id_count
+=
1
return
str
(
object
)
elif
object
==
"test_false_value"
:
self
.
false_count
+=
1
return
""
else
:
return
None
def
persistent_load
(
self
,
oid
):
self
.
load_count
+=
1
object
=
int
(
oid
)
assert
object
%
2
==
0
return
object
if
not
oid
:
self
.
load_false_count
+=
1
return
"test_false_value"
else
:
self
.
load_count
+=
1
object
=
int
(
oid
)
assert
object
%
2
==
0
return
object
def
test_persistence
(
self
):
self
.
id_count
=
0
self
.
load_count
=
0
L
=
list
(
range
(
10
))
self
.
assertEqual
(
self
.
loads
(
self
.
dumps
(
L
)),
L
)
self
.
assertEqual
(
self
.
id_count
,
5
)
self
.
assertEqual
(
self
.
load_count
,
5
)
def
test_bin_persistence
(
self
):
self
.
id_count
=
0
self
.
load_count
=
0
L
=
list
(
range
(
10
))
self
.
assertEqual
(
self
.
loads
(
self
.
dumps
(
L
,
1
)),
L
)
self
.
assertEqual
(
self
.
id_count
,
5
)
self
.
assertEqual
(
self
.
load_count
,
5
)
L
=
list
(
range
(
10
))
+
[
"test_false_value"
]
for
proto
in
protocols
:
self
.
id_count
=
0
self
.
false_count
=
0
self
.
load_false_count
=
0
self
.
load_count
=
0
self
.
assertEqual
(
self
.
loads
(
self
.
dumps
(
L
,
proto
)),
L
)
self
.
assertEqual
(
self
.
id_count
,
5
)
self
.
assertEqual
(
self
.
false_count
,
1
)
self
.
assertEqual
(
self
.
load_count
,
5
)
self
.
assertEqual
(
self
.
load_false_count
,
1
)
class
AbstractPicklerUnpicklerObjectTests
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
896414fe
...
...
@@ -21,6 +21,9 @@ Library
- Issue #19088: Fixed incorrect caching of the copyreg module in
object.__reduce__() and object.__reduce_ex__().
- Fixed _pickle.Unpickler to not fail when loading empty strings as
persistent IDs.
- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with
virtual interface. Original patch by Kent Frazier.
...
...
Modules/_pickle.c
Dosyayı görüntüle @
896414fe
...
...
@@ -4665,7 +4665,7 @@ load_persid(UnpicklerObject *self)
if
(
self
->
pers_func
)
{
if
((
len
=
_Unpickler_Readline
(
self
,
&
s
))
<
0
)
return
-
1
;
if
(
len
<
2
)
if
(
len
<
1
)
return
bad_readline
();
pid
=
PyBytes_FromStringAndSize
(
s
,
len
-
1
);
...
...
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