summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-04-05 14:18:13 (GMT)
committerGuido van Rossum <guido@python.org>1992-04-05 14:18:13 (GMT)
commiteee3fd495a601d672bbc242173a227104728ea7a (patch)
tree6cc8560ef8dc9cd731825c947763461f61a04408 /Python/ceval.c
parente765f7dbae84802e2b9be07844c104f36892af30 (diff)
downloadcpython-eee3fd495a601d672bbc242173a227104728ea7a.zip
cpython-eee3fd495a601d672bbc242173a227104728ea7a.tar.gz
cpython-eee3fd495a601d672bbc242173a227104728ea7a.tar.bz2
(Hopefully) fix bug in reference count in call_exc_trace()
plus minor rearrangements found during debugging
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ed99aea..f83efe0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1,5 +1,5 @@
/***********************************************************
-Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
+Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
Netherlands.
All Rights Reserved
@@ -1106,7 +1106,6 @@ eval_code(co, globals, locals, arg)
sysset("exc_traceback", v);
sysset("exc_value", val);
sysset("exc_type", exc);
- err_clear();
}
PUSH(v);
PUSH(val);
@@ -1192,21 +1191,19 @@ call_exc_trace(p_trace, p_newtrace, f)
err_get(&type, &value);
traceback = tb_fetch();
arg = newtupleobject(3);
- if (arg == NULL) {
- err = -1;
+ if (arg == NULL)
goto cleanup;
- }
settupleitem(arg, 0, type);
settupleitem(arg, 1, value);
settupleitem(arg, 2, traceback);
err = call_trace(p_trace, p_newtrace, f, "exception", arg);
- XDECREF(arg);
- cleanup:
if (!err) {
+ cleanup:
/* Restore original exception */
err_setval(type, value);
tb_store(traceback);
}
+ XDECREF(arg);
}
static int
@@ -1254,12 +1251,13 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
if (res == NULL) {
/* The trace proc raised an exception */
tb_here(f);
- XDECREF(*p_trace);
+ DECREF(*p_trace);
*p_trace = NULL;
if (p_newtrace) {
XDECREF(*p_newtrace);
*p_newtrace = NULL;
}
+ return -1;
}
else {
if (p_newtrace) {
@@ -1272,11 +1270,8 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
}
}
DECREF(res);
- }
- if (res == NULL)
- return -1;
- else
return 0;
+ }
}
object *