diff Python/ceval.c @ 1282:e0464e7115ca legacy-trunk

* 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
author Guido van Rossum <guido@python.org>
date Wed, 12 May 1993 08:24:20 +0000
parents 69a066b6b1ff
children 9fed5726a36d
line wrap: on
line diff
--- a/Python/ceval.c	Tue May 11 18:36:54 1993 +0000
+++ b/Python/ceval.c	Wed May 12 08:24:20 1993 +0000
@@ -58,7 +58,6 @@
 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 @@
 }
 
 
-/* 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;