[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 248 - trunk/subversion/tests/clients/cmdline/svntest

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-10-17 13:56:45 CEST

It is almost *always* wrong to use "except:" in a Python program. Seeing
that in some code should make you *very* suspicious. Sometimes, it can hide
some problems that you really want to see. In the case below, you're
catching it and throwing away the information -- the name of the exception
isn't even printed, let alone a traceback.

I don't know the code here, but I'd recommend thinking things through a
*few* times if you ever find yourself using "except:"

Cheers,
-g

On Tue, Oct 16, 2001 at 11:55:01AM -0500, sussman@tigris.org wrote:
> Author: sussman
> Date: 2001-10-16 16:54 GMT
> New Revision: 248
>
> Modified:
> trunk/subversion/tests/clients/cmdline/svntest/main.py
> Log:
>
> * main.py (run_one_test): catch *all* exceptions and return error.
>
>
> Modified: trunk/subversion/tests/clients/cmdline/svntest/main.py
> ==============================================================================
> --- OLD/trunk/subversion/tests/clients/cmdline/svntest/main.py Tue Oct 16 11:54:59 2001
> +++ NEW/trunk/subversion/tests/clients/cmdline/svntest/main.py Tue Oct 16 11:54:59 2001
> @@ -249,7 +249,11 @@
> print "There is no test", `n` + ".\n"
> return 1
> # Run the test.
> - error = test_list[n]()
> + try:
> + error = test_list[n]()
> + except:
> + print "caught an exception, returning error instead"
> + error = 1
> if error:
> print "FAIL:",
> else:
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:44 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.