summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-05-26 23:14:37 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-05-26 23:14:37 (GMT)
commit7df5e7f4b2cd1f0dac674a7b10261a2e8c657636 (patch)
treeb899bfa326e7dd5afc7b4d82f5869580412e9f7c /Include
parent7e0a62ea9052faf0e19dc2438124751b8f68ce16 (diff)
downloadcpython-7df5e7f4b2cd1f0dac674a7b10261a2e8c657636.zip
cpython-7df5e7f4b2cd1f0dac674a7b10261a2e8c657636.tar.gz
cpython-7df5e7f4b2cd1f0dac674a7b10261a2e8c657636.tar.bz2
Patch 1145039.
set_exc_info(), reset_exc_info(): By exploiting the likely (who knows?) invariant that when an exception's `type` is NULL, its `value` and `traceback` are also NULL, save some cycles in heavily-executed code. This is a "a kronar saved is a kronar earned" patch: the speedup isn't reliably measurable, but it obviously does reduce the operation count in the normal (no exception raised) path through PyEval_EvalFrameEx(). The tim-exc_sanity branch tries to push this harder, but is still blowing up (at least in part due to pre-existing subtle bugs that appear to have no other visible consequences!). Not a bugfix candidate.
Diffstat (limited to 'Include')
-rw-r--r--Include/frameobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 1e3a01e..cce598b 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -26,7 +26,16 @@ typedef struct _frame {
to the current stack top. */
PyObject **f_stacktop;
PyObject *f_trace; /* Trace function */
+
+ /* If an exception is raised in this frame, the next three are used to
+ * record the exception info (if any) originally in the thread state. See
+ * comments before set_exc_info() -- it's not obvious.
+ * Invariant: if _type is NULL, then so are _value and _traceback.
+ * Desired invariant: all three are NULL, or all three are non-NULL. That
+ * one isn't currently true, but "should be".
+ */
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
+
PyThreadState *f_tstate;
int f_lasti; /* Last instruction if called */
/* As of 2.3 f_lineno is only valid when tracing is active (i.e. when