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
7b7099c3
Kaydet (Commit)
7b7099c3
authored
Tem 03, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2 (#12475)
üst
92843e3c
d2ed6302
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
test_exceptions.py
Lib/test/test_exceptions.py
+15
-0
NEWS
Misc/NEWS
+3
-0
ceval.c
Python/ceval.c
+5
-4
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
7b7099c3
...
...
@@ -567,6 +567,21 @@ class ExceptionTests(unittest.TestCase):
del
g
self
.
assertEqual
(
sys
.
exc_info
()[
0
],
TypeError
)
def
test_generator_leaking2
(
self
):
# See issue 12475.
def
g
():
yield
try
:
raise
RuntimeError
except
RuntimeError
:
it
=
g
()
next
(
it
)
try
:
next
(
it
)
except
StopIteration
:
pass
self
.
assertEqual
(
sys
.
exc_info
(),
(
None
,
None
,
None
))
def
test_generator_finalizing_and_exc_info
(
self
):
# See #7173
def
simple_gen
():
...
...
Misc/NEWS
Dosyayı görüntüle @
7b7099c3
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
-----------------
- Issue #12475: Prevent generators from leaking their exception state into the
callers frame as they return for the last time.
- Issue #12291: You can now load multiple marshalled objects from a stream,
with other data interleaved between marshalled objects.
...
...
Python/ceval.c
Dosyayı görüntüle @
7b7099c3
...
...
@@ -1865,10 +1865,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
retval
=
POP
();
f
->
f_stacktop
=
stack_pointer
;
why
=
WHY_YIELD
;
/* Put aside the current exception state and restore
that of the calling frame. This only serves when
"yield" is used inside an except handler. */
SWAP_EXC_STATE
();
goto
fast_yield
;
TARGET
(
POP_EXCEPT
)
...
...
@@ -3005,6 +3001,11 @@ fast_block_end:
retval
=
NULL
;
fast_yield:
if
(
co
->
co_flags
&
CO_GENERATOR
&&
(
why
==
WHY_YIELD
||
why
==
WHY_RETURN
))
/* Put aside the current exception state and restore that of the
calling frame. */
SWAP_EXC_STATE
();
if
(
tstate
->
use_tracing
)
{
if
(
tstate
->
c_tracefunc
)
{
if
(
why
==
WHY_RETURN
||
why
==
WHY_YIELD
)
{
...
...
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