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
3c9f541e
Kaydet (Commit)
3c9f541e
authored
Eyl 13, 2008
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #3850: Misc/find_recursionlimit.py was broken.
Reviewed by A.M. Kuchling.
üst
d51e07f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
8 deletions
+27
-8
NEWS
Misc/NEWS
+8
-0
find_recursionlimit.py
Misc/find_recursionlimit.py
+19
-8
No files found.
Misc/NEWS
Dosyayı görüntüle @
3c9f541e
...
...
@@ -15,6 +15,14 @@ Core and Builtins
Library
-------
Tools/Demos
-----------
- Issue #3850: recursion tests in Misc/find_recursion_limit.py can raise
AttributeError instead of RuntimeError, depending in which C API call
exactly the recursion limit is exceeded. Consequently, both exception types
are caught and silenced.
What's New in Python 2.6 release candidate 1?
=============================================
...
...
Misc/find_recursionlimit.py
Dosyayı görüntüle @
3c9f541e
#! /usr/bin/env python
"""Find the maximum recursion limit that prevents
core dumps
"""Find the maximum recursion limit that prevents
interpreter termination.
This script finds the maximum safe recursion limit on a particular
platform. If you need to change the recursion limit on your system,
this script will tell you a safe upper bound. To use the new limit,
call sys.setrecursionlimit.
call sys.setrecursionlimit
()
.
This module implements several ways to create infinite recursion in
Python. Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.
After each round of tests, it prints a message
Limit of NNNN is fine
.
After each round of tests, it prints a message
:
"Limit of NNNN is fine"
.
It ends when Python causes a segmentation fault because the limit is
too high. On platforms like Mac and Windows, it should exit with a
MemoryError.
The highest printed value of "NNNN" is therefore the highest potentially
safe limit for your system (which depends on the OS, architecture, but also
the compilation flags). Please note that it is practically impossible to
test all possible recursion paths in the interpreter, so the results of
this test should not be trusted blindly -- although they give a good hint
of which values are reasonable.
NOTE: When the C stack space allocated by your system is exceeded due
to excessive recursion, exact behaviour depends on the platform, although
the interpreter will always fail in a likely brutal way: either a
segmentation fault, a MemoryError, or just a silent abort.
NB: A program that does not use __methods__ can set a higher limit.
"""
...
...
@@ -88,7 +96,10 @@ def check_limit(n, test_func_name):
test_func
=
globals
()[
test_func_name
]
try
:
test_func
()
except
RuntimeError
:
# AttributeError can be raised because of the way e.g. PyDict_GetItem()
# silences all exceptions and returns NULL, which is usually interpreted
# as "missing attribute".
except
(
RuntimeError
,
AttributeError
):
pass
else
:
print
"Yikes!"
...
...
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