summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-09-04 19:03:35 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-09-04 19:03:35 (GMT)
commit6c0f20088f81d9d84124c265d58a2a8e7d47b059 (patch)
tree2fb87171458614f459e3bf99f171d967622ca470 /Python/ceval.c
parent1b41079fd9408951fbf2d740a598090a5b6bb015 (diff)
downloadcpython-6c0f20088f81d9d84124c265d58a2a8e7d47b059.zip
cpython-6c0f20088f81d9d84124c265d58a2a8e7d47b059.tar.gz
cpython-6c0f20088f81d9d84124c265d58a2a8e7d47b059.tar.bz2
Move call_trace(..., PyTrace_CALL, ...) call to top of eval_frame. That
way it's called each time a generator is resumed. The tracing of normal functions should be unaffected by this change.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 6eebf94..030afe6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -588,6 +588,41 @@ eval_frame(PyFrameObject *f)
assert(stack_pointer != NULL);
f->f_stacktop = NULL;
+ if (tstate->use_tracing) {
+ if (tstate->c_tracefunc != NULL) {
+ /* tstate->c_tracefunc, if defined, is a
+ function that will be called on *every* entry
+ to a code block. Its return value, if not
+ None, is a function that will be called at
+ the start of each executed line of code.
+ (Actually, the function must return itself
+ in order to continue tracing.) The trace
+ functions are called with three arguments:
+ a pointer to the current frame, a string
+ indicating why the function is called, and
+ an argument which depends on the situation.
+ The global trace function is also called
+ whenever an exception is detected. */
+ if (call_trace(tstate->c_tracefunc, tstate->c_traceobj,
+ f, PyTrace_CALL, Py_None)) {
+ /* XXX Need way to compute arguments?? */
+ /* Trace function raised an error */
+ return NULL;
+ }
+ }
+ if (tstate->c_profilefunc != NULL) {
+ /* Similar for c_profilefunc, except it needn't
+ return itself and isn't called for "line" events */
+ if (call_trace(tstate->c_profilefunc,
+ tstate->c_profileobj,
+ f, PyTrace_CALL, Py_None)) {
+ /* XXX Need way to compute arguments?? */
+ /* Profile function raised an error */
+ return NULL;
+ }
+ }
+ }
+
#ifdef LLTRACE
lltrace = PyDict_GetItemString(f->f_globals,"__lltrace__") != NULL;
#endif
@@ -2496,41 +2531,6 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
}
}
- if (tstate->use_tracing) {
- if (tstate->c_tracefunc != NULL) {
- /* tstate->c_tracefunc, if defined, is a
- function that will be called on *every* entry
- to a code block. Its return value, if not
- None, is a function that will be called at
- the start of each executed line of code.
- (Actually, the function must return itself
- in order to continue tracing.) The trace
- functions are called with three arguments:
- a pointer to the current frame, a string
- indicating why the function is called, and
- an argument which depends on the situation.
- The global trace function is also called
- whenever an exception is detected. */
- if (call_trace(tstate->c_tracefunc, tstate->c_traceobj,
- f, PyTrace_CALL, Py_None)) {
- /* XXX Need way to compute arguments?? */
- /* Trace function raised an error */
- goto fail;
- }
- }
- if (tstate->c_profilefunc != NULL) {
- /* Similar for c_profilefunc, except it needn't
- return itself and isn't called for "line" events */
- if (call_trace(tstate->c_profilefunc,
- tstate->c_profileobj,
- f, PyTrace_CALL, Py_None)) {
- /* XXX Need way to compute arguments?? */
- /* Profile function raised an error */
- goto fail;
- }
- }
- }
-
if (co->co_flags & CO_GENERATOR) {
/* Don't need to keep the reference to f_back, it will be set
* when the generator is resumed. */