Modernize Python exception syntax in tests

Change the exception syntax used in the tests to use the more current

    except Exception as ex:

rather than the old

    except Exception, ex:

Since support for Python <2.6 has been removed, all supported versions
now support the new style, and we can save one step in the Python 3
compatibility conversion.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com
This commit is contained in:
Peter Eisentraut
2020-01-08 21:48:44 +01:00
parent 37f21ed132
commit 45223fd9ce
16 changed files with 27 additions and 28 deletions

View File

@ -29,7 +29,7 @@ CREATE FUNCTION test_param_names3(a0 integer) RETURNS boolean AS $$
try:
assert a1 == args[0]
return False
except NameError, e:
except NameError as e:
assert e.args[0].find("a1") > -1
return True
$$ LANGUAGE plpythonu;