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
57bef68b
Kaydet (Commit)
57bef68b
authored
May 26, 2009
tarafından
Collin Winter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 5794: fix cPickle's unpickling of recursive tuples.
üst
944f684c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
pickletester.py
Lib/test/pickletester.py
+10
-0
test_cpickle.py
Lib/test/test_cpickle.py
+5
-0
cPickle.c
Modules/cPickle.c
+9
-10
No files found.
Lib/test/pickletester.py
Dosyayı görüntüle @
57bef68b
...
...
@@ -463,6 +463,16 @@ class AbstractPickleTests(unittest.TestCase):
self
.
assertEqual
(
len
(
x
),
1
)
self
.
assert_
(
x
is
x
[
0
])
def
test_recursive_tuple
(
self
):
t
=
([],)
t
[
0
]
.
append
(
t
)
for
proto
in
protocols
:
s
=
self
.
dumps
(
t
,
proto
)
x
=
self
.
loads
(
s
)
self
.
assertEqual
(
len
(
x
),
1
)
self
.
assertEqual
(
len
(
x
[
0
]),
1
)
self
.
assert_
(
x
is
x
[
0
][
0
])
def
test_recursive_dict
(
self
):
d
=
{}
d
[
1
]
=
d
...
...
Lib/test/test_cpickle.py
Dosyayı görüntüle @
57bef68b
...
...
@@ -65,6 +65,11 @@ class cPickleFastPicklerTests(AbstractPickleTests):
AbstractPickleTests
.
test_recursive_list
,
self
)
def
test_recursive_tuple
(
self
):
self
.
assertRaises
(
ValueError
,
AbstractPickleTests
.
test_recursive_tuple
,
self
)
def
test_recursive_inst
(
self
):
self
.
assertRaises
(
ValueError
,
AbstractPickleTests
.
test_recursive_inst
,
...
...
Modules/cPickle.c
Dosyayı görüntüle @
57bef68b
...
...
@@ -4086,25 +4086,24 @@ load_binpersid(Unpicklerobject *self)
static
int
load_pop
(
Unpicklerobject
*
self
)
{
int
len
;
if
(
!
(
(
len
=
self
->
stack
->
length
)
>
0
))
return
stackUnderflow
();
int
len
=
self
->
stack
->
length
;
/* Note that we split the (pickle.py) stack into two stacks,
an object stack and a mark stack. We have to be clever and
pop the right one. We do this by looking at the top of the
mark stack.
mark stack first, and only signalling a stack underflow if
the object stack is empty and the mark stack doesn't match
our expectations.
*/
if
((
self
->
num_marks
>
0
)
&&
(
self
->
marks
[
self
->
num_marks
-
1
]
==
len
))
if
(
self
->
num_marks
>
0
&&
self
->
marks
[
self
->
num_marks
-
1
]
==
len
)
{
self
->
num_marks
--
;
else
{
}
else
if
(
len
>=
0
)
{
len
--
;
Py_DECREF
(
self
->
stack
->
data
[
len
]);
self
->
stack
->
length
=
len
;
self
->
stack
->
length
=
len
;
}
else
{
return
stackUnderflow
();
}
return
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