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
27d63678
Kaydet (Commit)
27d63678
authored
Haz 15, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
improvements to the fix for #3114
keep the tstate consistent and a better test
üst
df6dc8f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
23 deletions
+28
-23
test_exceptions.py
Lib/test/test_exceptions.py
+4
-9
ceval.c
Python/ceval.c
+24
-14
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
27d63678
...
...
@@ -5,8 +5,6 @@ import sys
import
unittest
import
pickle
import
weakref
import
gc
import
traceback
from
test.support
import
TESTFN
,
unlink
,
run_unittest
...
...
@@ -553,9 +551,9 @@ class ExceptionTests(unittest.TestCase):
del
g
self
.
assertEquals
(
sys
.
exc_info
()[
0
],
TypeError
)
def
test_
crash_
3114
(
self
):
# Bug #3114: in its destructor, MyObject retrieves a pointer to
a
#
deallocated exception instance or traceback
.
def
test_3114
(
self
):
# Bug #3114: in its destructor, MyObject retrieves a pointer to
#
obsolete and/or deallocated objects
.
class
MyObject
:
def
__del__
(
self
):
nonlocal
e
...
...
@@ -565,10 +563,7 @@ class ExceptionTests(unittest.TestCase):
raise
Exception
(
MyObject
())
except
:
pass
gc
.
collect
()
[
0
]
*
10000
# Do something with the exception and its traceback
traceback
.
format_exception
(
*
e
)
self
.
assertEquals
(
e
,
(
None
,
None
,
None
))
def
test_main
():
run_unittest
(
ExceptionTests
)
...
...
Python/ceval.c
Dosyayı görüntüle @
27d63678
...
...
@@ -699,29 +699,39 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
#define UNWIND_EXCEPT_HANDLER(b) \
assert(STACK_LEVEL() >= (b)->b_level + 3); \
while (STACK_LEVEL() > (b)->b_level + 3) { \
PyObject *v = POP(); \
Py_XDECREF(v); \
} \
Py_CLEAR(tstate->exc_type); \
Py_CLEAR(tstate->exc_value); \
Py_CLEAR(tstate->exc_traceback); \
tstate->exc_type = POP(); \
tstate->exc_value = POP(); \
tstate->exc_traceback = POP();
{ \
PyObject *type, *value, *traceback; \
assert(STACK_LEVEL() >= (b)->b_level + 3); \
while (STACK_LEVEL() > (b)->b_level + 3) { \
value = POP(); \
Py_XDECREF(value); \
} \
type = tstate->exc_type; \
value = tstate->exc_value; \
traceback = tstate->exc_traceback; \
tstate->exc_type = POP(); \
tstate->exc_value = POP(); \
tstate->exc_traceback = POP(); \
Py_XDECREF(type); \
Py_XDECREF(value); \
Py_XDECREF(traceback); \
}
#define SAVE_EXC_STATE() \
{ \
PyObject *type, *value, *traceback; \
Py_XINCREF(tstate->exc_type); \
Py_XINCREF(tstate->exc_value); \
Py_XINCREF(tstate->exc_traceback); \
Py_CLEAR(f->f_exc_type)
; \
Py_CLEAR(f->f_exc_value)
; \
Py_CLEAR(f->f_exc_traceback)
; \
type = f->f_exc_type
; \
value = f->f_exc_value
; \
traceback = f->f_exc_traceback
; \
f->f_exc_type = tstate->exc_type; \
f->f_exc_value = tstate->exc_value; \
f->f_exc_traceback = tstate->exc_traceback; \
Py_XDECREF(type); \
Py_XDECREF(value); \
Py_XDECREF(traceback); \
}
#define SWAP_EXC_STATE() \
...
...
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