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
8918b89e
Kaydet (Commit)
8918b89e
authored
Haz 12, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #25455: Clean up reference loops created in tests for recursive
functools.partial objects.
üst
0f355c00
46fe29de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
12 deletions
+36
-12
test_functools.py
Lib/test/test_functools.py
+36
-12
No files found.
Lib/test/test_functools.py
Dosyayı görüntüle @
8918b89e
...
...
@@ -225,15 +225,24 @@ class TestPartialC(TestPartial, unittest.TestCase):
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
f
,
(),
{},
{}))
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
s(...))'
%
(
name
,
name
))
try
:
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
s(...))'
%
(
name
,
name
))
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
capture
,
(
f
,),
{},
{}))
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
r,
%
s(...))'
%
(
name
,
capture
,
name
))
try
:
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
r,
%
s(...))'
%
(
name
,
capture
,
name
))
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
capture
,
(),
{
'a'
:
f
},
{}))
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
r, a=
%
s(...))'
%
(
name
,
capture
,
name
))
try
:
self
.
assertEqual
(
repr
(
f
),
'
%
s(
%
r, a=
%
s(...))'
%
(
name
,
capture
,
name
))
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
def
test_pickle
(
self
):
f
=
self
.
partial
(
signature
,
[
'asdf'
],
bar
=
[
True
])
...
...
@@ -318,21 +327,36 @@ class TestPartialC(TestPartial, unittest.TestCase):
def
test_recursive_pickle
(
self
):
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
f
,
(),
{},
{}))
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
with
self
.
assertRaises
(
RecursionError
):
pickle
.
dumps
(
f
,
proto
)
try
:
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
with
self
.
assertRaises
(
RecursionError
):
pickle
.
dumps
(
f
,
proto
)
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
capture
,
(
f
,),
{},
{}))
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
f_copy
=
pickle
.
loads
(
pickle
.
dumps
(
f
,
proto
))
self
.
assertIs
(
f_copy
.
args
[
0
],
f_copy
)
try
:
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
f_copy
=
pickle
.
loads
(
pickle
.
dumps
(
f
,
proto
))
try
:
self
.
assertIs
(
f_copy
.
args
[
0
],
f_copy
)
finally
:
f_copy
.
__setstate__
((
capture
,
(),
{},
{}))
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
f
=
self
.
partial
(
capture
)
f
.
__setstate__
((
capture
,
(),
{
'a'
:
f
},
{}))
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
f_copy
=
pickle
.
loads
(
pickle
.
dumps
(
f
,
proto
))
self
.
assertIs
(
f_copy
.
keywords
[
'a'
],
f_copy
)
try
:
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
f_copy
=
pickle
.
loads
(
pickle
.
dumps
(
f
,
proto
))
try
:
self
.
assertIs
(
f_copy
.
keywords
[
'a'
],
f_copy
)
finally
:
f_copy
.
__setstate__
((
capture
,
(),
{},
{}))
finally
:
f
.
__setstate__
((
capture
,
(),
{},
{}))
# Issue 6083: Reference counting bug
def
test_setstate_refcount
(
self
):
...
...
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