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
87880243
Kaydet (Commit)
87880243
authored
Tem 03, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
convert generator exc state functions into static functions
üst
536feac7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
54 deletions
+62
-54
ceval.c
Python/ceval.c
+62
-54
No files found.
Python/ceval.c
Dosyayı görüntüle @
87880243
...
@@ -749,6 +749,9 @@ enum why_code {
...
@@ -749,6 +749,9 @@ enum why_code {
WHY_SILENCED
=
0x0080
/* Exception silenced by 'with' */
WHY_SILENCED
=
0x0080
/* Exception silenced by 'with' */
};
};
static
void
save_exc_state
(
PyThreadState
*
,
PyFrameObject
*
);
static
void
swap_exc_state
(
PyThreadState
*
,
PyFrameObject
*
);
static
void
restore_and_clear_exc_state
(
PyThreadState
*
,
PyFrameObject
*
);
static
enum
why_code
do_raise
(
PyObject
*
,
PyObject
*
);
static
enum
why_code
do_raise
(
PyObject
*
,
PyObject
*
);
static
int
unpack_iterable
(
PyObject
*
,
int
,
int
,
PyObject
**
);
static
int
unpack_iterable
(
PyObject
*
,
int
,
int
,
PyObject
**
);
...
@@ -1110,54 +1113,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
...
@@ -1110,54 +1113,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_XDECREF(traceback); \
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); \
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() \
{ \
PyObject *tmp; \
tmp = tstate->exc_type; \
tstate->exc_type = f->f_exc_type; \
f->f_exc_type = tmp; \
tmp = tstate->exc_value; \
tstate->exc_value = f->f_exc_value; \
f->f_exc_value = tmp; \
tmp = tstate->exc_traceback; \
tstate->exc_traceback = f->f_exc_traceback; \
f->f_exc_traceback = tmp; \
}
#define RESTORE_AND_CLEAR_EXC_STATE() \
{ \
PyObject *type, *value, *tb; \
type = tstate->exc_type; \
value = tstate->exc_value; \
tb = tstate->exc_traceback; \
tstate->exc_type = f->f_exc_type; \
tstate->exc_value = f->f_exc_value; \
tstate->exc_traceback = f->f_exc_traceback; \
f->f_exc_type = NULL; \
f->f_exc_value = NULL; \
f->f_exc_traceback = NULL; \
Py_XDECREF(type); \
Py_XDECREF(value); \
Py_XDECREF(tb); \
}
/* Start of code */
/* Start of code */
if
(
f
==
NULL
)
if
(
f
==
NULL
)
...
@@ -1236,11 +1191,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
...
@@ -1236,11 +1191,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
/* We were in an except handler when we left,
/* We were in an except handler when we left,
restore the exception state which was put aside
restore the exception state which was put aside
(see YIELD_VALUE). */
(see YIELD_VALUE). */
SWAP_EXC_STATE
();
swap_exc_state
(
tstate
,
f
);
}
else
{
SAVE_EXC_STATE
();
}
}
else
save_exc_state
(
tstate
,
f
);
}
}
#ifdef LLTRACE
#ifdef LLTRACE
...
@@ -3033,9 +2987,9 @@ fast_yield:
...
@@ -3033,9 +2987,9 @@ fast_yield:
break
;
break
;
if
(
i
==
f
->
f_iblock
)
if
(
i
==
f
->
f_iblock
)
/* We did not create this exception. */
/* We did not create this exception. */
RESTORE_AND_CLEAR_EXC_STATE
()
restore_and_clear_exc_state
(
tstate
,
f
);
else
else
SWAP_EXC_STATE
()
swap_exc_state
(
tstate
,
f
);
}
}
if
(
tstate
->
use_tracing
)
{
if
(
tstate
->
use_tracing
)
{
...
@@ -3453,6 +3407,60 @@ special_lookup(PyObject *o, char *meth, PyObject **cache)
...
@@ -3453,6 +3407,60 @@ special_lookup(PyObject *o, char *meth, PyObject **cache)
}
}
/* These 3 functions deal with the exception state of generators. */
static
void
save_exc_state
(
PyThreadState
*
tstate
,
PyFrameObject
*
f
)
{
PyObject
*
type
,
*
value
,
*
traceback
;
Py_XINCREF
(
tstate
->
exc_type
);
Py_XINCREF
(
tstate
->
exc_value
);
Py_XINCREF
(
tstate
->
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
);
}
static
void
swap_exc_state
(
PyThreadState
*
tstate
,
PyFrameObject
*
f
)
{
PyObject
*
tmp
;
tmp
=
tstate
->
exc_type
;
tstate
->
exc_type
=
f
->
f_exc_type
;
f
->
f_exc_type
=
tmp
;
tmp
=
tstate
->
exc_value
;
tstate
->
exc_value
=
f
->
f_exc_value
;
f
->
f_exc_value
=
tmp
;
tmp
=
tstate
->
exc_traceback
;
tstate
->
exc_traceback
=
f
->
f_exc_traceback
;
f
->
f_exc_traceback
=
tmp
;
}
static
void
restore_and_clear_exc_state
(
PyThreadState
*
tstate
,
PyFrameObject
*
f
)
{
PyObject
*
type
,
*
value
,
*
tb
;
type
=
tstate
->
exc_type
;
value
=
tstate
->
exc_value
;
tb
=
tstate
->
exc_traceback
;
tstate
->
exc_type
=
f
->
f_exc_type
;
tstate
->
exc_value
=
f
->
f_exc_value
;
tstate
->
exc_traceback
=
f
->
f_exc_traceback
;
f
->
f_exc_type
=
NULL
;
f
->
f_exc_value
=
NULL
;
f
->
f_exc_traceback
=
NULL
;
Py_XDECREF
(
type
);
Py_XDECREF
(
value
);
Py_XDECREF
(
tb
);
}
/* Logic for the raise statement (too complicated for inlining).
/* Logic for the raise statement (too complicated for inlining).
This *consumes* a reference count to each of its arguments. */
This *consumes* a reference count to each of its arguments. */
static
enum
why_code
static
enum
why_code
...
...
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