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
4bf21e28
Kaydet (Commit)
4bf21e28
authored
Ara 07, 2011
tarafından
Amaury Forgeot d'Arc
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13546: Fixed an overflow issue that could crash the intepreter when
calling sys.setrecursionlimit((1<<31)-1). 2.7 only.
üst
a94b5784
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
test_sys.py
Lib/test/test_sys.py
+12
-0
NEWS
Misc/NEWS
+3
-0
errors.c
Python/errors.c
+4
-2
No files found.
Lib/test/test_sys.py
Dosyayı görüntüle @
4bf21e28
...
...
@@ -224,6 +224,18 @@ class SysModuleTest(unittest.TestCase):
self
.
assertEqual
(
sys
.
getrecursionlimit
(),
10000
)
sys
.
setrecursionlimit
(
oldlimit
)
self
.
assertRaises
(
OverflowError
,
sys
.
setrecursionlimit
,
1
<<
31
)
try
:
sys
.
setrecursionlimit
((
1
<<
31
)
-
5
)
try
:
# issue13546: isinstance(e, ValueError) used to fail
# when the recursion limit is close to 1<<31
raise
ValueError
()
except
ValueError
,
e
:
pass
finally
:
sys
.
setrecursionlimit
(
oldlimit
)
def
test_getwindowsversion
(
self
):
# Raise SkipTest if sys doesn't have getwindowsversion attribute
test
.
test_support
.
get_attribute
(
sys
,
"getwindowsversion"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
4bf21e28
...
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
Core and Builtins
-----------------
- Issue #13546: Fixed an overflow issue that could crash the intepreter when
calling sys.setrecursionlimit((1<<31)-1).
- Issue #13333: The UTF-7 decoder now accepts lone surrogates (the encoder
already accepts them).
...
...
Python/errors.c
Dosyayı görüntüle @
4bf21e28
...
...
@@ -111,9 +111,11 @@ PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
PyErr_Fetch
(
&
exception
,
&
value
,
&
tb
);
/* Temporarily bump the recursion limit, so that in the most
common case PyObject_IsSubclass will not raise a recursion
error we have to ignore anyway. */
error we have to ignore anyway. Don't do it when the limit
is already insanely high, to avoid overflow */
reclimit
=
Py_GetRecursionLimit
();
Py_SetRecursionLimit
(
reclimit
+
5
);
if
(
reclimit
<
(
1
<<
30
))
Py_SetRecursionLimit
(
reclimit
+
5
);
res
=
PyObject_IsSubclass
(
err
,
exc
);
Py_SetRecursionLimit
(
reclimit
);
/* This function must not fail, so print the error here */
...
...
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