summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-05-12 08:24:20 (GMT)
committerGuido van Rossum <guido@python.org>1993-05-12 08:24:20 (GMT)
commit6ac258d381b5300e3ec935404a111e8dff4617d4 (patch)
tree476a8c807f8f91cc5c259af586b3470201a9c2c1 /Python
parentad4fcd49fc5c9ec93743f93da518b84e0634ea59 (diff)
downloadcpython-6ac258d381b5300e3ec935404a111e8dff4617d4.zip
cpython-6ac258d381b5300e3ec935404a111e8dff4617d4.tar.gz
cpython-6ac258d381b5300e3ec935404a111e8dff4617d4.tar.bz2
* pythonrun.c: Print exception type+arg *after* stack trace instead of
before it. * ceval.c, object.c: moved testbool() to object.c (now extern visible) * stringobject.c: fix bugs in and rationalize string resize in formatstring() * tokenizer.[ch]: fix non-working code for lines longer than BUFSIZ
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c24
-rw-r--r--Python/pythonrun.c2
2 files changed, 1 insertions, 25 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 935ce52..44239e6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -58,7 +58,6 @@ static int prtrace PROTO((object *, char *));
static void call_exc_trace PROTO((object **, object**, frameobject *));
static int call_trace
PROTO((object **, object **, frameobject *, char *, object *));
-static int testbool PROTO((object *));
static object *add PROTO((object *, object *));
static object *sub PROTO((object *, object *));
static object *mul PROTO((object *, object *));
@@ -1612,29 +1611,6 @@ flushline()
}
-/* Test a value used as condition, e.g., in a for or if statement.
- Return -1 if an error occurred */
-
-static int
-testbool(v)
- object *v;
-{
- int res;
- if (v == None)
- res = 0;
- else if (v->ob_type->tp_as_number != NULL)
- res = (*v->ob_type->tp_as_number->nb_nonzero)(v);
- else if (v->ob_type->tp_as_mapping != NULL)
- res = (*v->ob_type->tp_as_mapping->mp_length)(v);
- else if (v->ob_type->tp_as_sequence != NULL)
- res = (*v->ob_type->tp_as_sequence->sq_length)(v);
- else
- res = 1;
- if (res > 0)
- res = 1;
- return res;
-}
-
static object *
or(v, w)
object *v, *w;
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 98008b4..3898d13 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -245,6 +245,7 @@ print_error()
if (f == NULL)
fprintf(stderr, "lost sys.stderr\n");
else {
+ printtraceback(f);
if (writeobject(exception, f, PRINT_RAW) != 0)
err_clear();
if (v != NULL && v != None) {
@@ -253,7 +254,6 @@ print_error()
err_clear();
}
writestring("\n", f);
- printtraceback(f);
}
XDECREF(exception);
XDECREF(v);