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
d222559c
Kaydet (Commit)
d222559c
authored
Mar 28, 2002
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New test_traschcan() test in test_gc, which reliably provokes segfaults
under 2.0, 2.1 and 2.2. Bugfix candidate.
üst
8d62e947
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
test_gc.py
Lib/test/test_gc.py
+29
-0
No files found.
Lib/test/test_gc.py
Dosyayı görüntüle @
d222559c
...
...
@@ -171,6 +171,34 @@ def test_del():
gc
.
disable
()
apply
(
gc
.
set_threshold
,
thresholds
)
class
Ouch
:
n
=
0
def
__del__
(
self
):
Ouch
.
n
=
Ouch
.
n
+
1
if
Ouch
.
n
%
7
==
0
:
gc
.
collect
()
def
test_trashcan
():
# "trashcan" is a hack to prevent stack overflow when deallocating
# very deeply nested tuples etc. It works in part by abusing the
# type pointer and refcount fields, and that can yield horrible
# problems when gc tries to traverse the structures.
# If this test fails (as it does in 2.0, 2.1 and 2.2), it will
# most likely die via segfault.
gc
.
enable
()
N
=
200
for
i
in
range
(
3
):
t
=
[]
for
i
in
range
(
N
):
t
=
[
t
,
Ouch
()]
u
=
[]
for
i
in
range
(
N
):
u
=
[
u
,
Ouch
()]
v
=
{}
for
i
in
range
(
N
):
v
=
{
1
:
v
,
2
:
Ouch
()}
gc
.
disable
()
def
test_all
():
gc
.
collect
()
# Delete 2nd generation garbage
...
...
@@ -187,6 +215,7 @@ def test_all():
run_test
(
"finalizers"
,
test_finalizer
)
run_test
(
"__del__"
,
test_del
)
run_test
(
"saveall"
,
test_saveall
)
run_test
(
"trashcan"
,
test_trashcan
)
def
test
():
if
verbose
:
...
...
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