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
c3349cd2
Kaydet (Commit)
c3349cd2
authored
Tem 15, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
port 8d05f697acd4 (#11627)
üst
2659140a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
test_exceptions.py
Lib/test/test_exceptions.py
+8
-0
NEWS
Misc/NEWS
+3
-0
ceval.c
Python/ceval.c
+10
-2
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
c3349cd2
...
...
@@ -464,6 +464,14 @@ class ExceptionTests(unittest.TestCase):
self
.
assertTrue
(
e
is
RuntimeError
,
e
)
self
.
assertIn
(
"maximum recursion depth exceeded"
,
str
(
v
))
def
test_new_returns_invalid_instance
(
self
):
# See issue #11627.
class
MyException
(
Exception
):
def
__new__
(
cls
,
*
args
):
return
object
()
with
self
.
assertRaises
(
TypeError
):
raise
MyException
# Helper class used by TestSameStrAndUnicodeMsg
...
...
Misc/NEWS
Dosyayı görüntüle @
c3349cd2
...
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
Core and Builtins
-----------------
- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception
class.
- Issue #12149: Update the method cache after a type'
s
dictionnary
gets
cleared
by
the
garbage
collector
.
This
fixes
a
segfault
when
an
instance
and
its
type
get
caught
in
a
reference
cycle
,
and
the
instance
's
...
...
Python/ceval.c
Dosyayı görüntüle @
c3349cd2
...
...
@@ -3515,9 +3515,17 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
Py_DECREF
(
tmp
);
}
if
(
PyExceptionClass_Check
(
type
))
if
(
PyExceptionClass_Check
(
type
))
{
PyErr_NormalizeException
(
&
type
,
&
value
,
&
tb
);
if
(
!
PyExceptionInstance_Check
(
value
))
{
PyErr_Format
(
PyExc_TypeError
,
"calling %s() should have returned an instance of "
"BaseException, not '%s'"
,
((
PyTypeObject
*
)
type
)
->
tp_name
,
Py_TYPE
(
value
)
->
tp_name
);
goto
raise_error
;
}
}
else
if
(
PyExceptionInstance_Check
(
type
))
{
/* Raising an instance. The value should be a dummy. */
if
(
value
!=
Py_None
)
{
...
...
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