From 45223fd9cefe483daa4af7740f15c004486636eb Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 8 Jan 2020 21:48:44 +0100 Subject: 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 Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com --- src/pl/plpython/sql/plpython_ereport.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pl/plpython/sql/plpython_ereport.sql') diff --git a/src/pl/plpython/sql/plpython_ereport.sql b/src/pl/plpython/sql/plpython_ereport.sql index 889293d33c..58df2057ef 100644 --- a/src/pl/plpython/sql/plpython_ereport.sql +++ b/src/pl/plpython/sql/plpython_ereport.sql @@ -125,7 +125,7 @@ $$; DO $$ try: plpy.execute("select raise_exception(_message => 'my message', _sqlstate => 'XX987', _hint => 'some hint', _table_name => 'users_tab', _datatype_name => 'user_type')") -except Exception, e: +except Exception as e: plpy.info(e.spidata) raise e $$ LANGUAGE plpythonu; @@ -133,7 +133,7 @@ $$ LANGUAGE plpythonu; DO $$ try: plpy.error(message = 'my message', sqlstate = 'XX987', hint = 'some hint', table_name = 'users_tab', datatype_name = 'user_type') -except Exception, e: +except Exception as e: plpy.info('sqlstate: %s, hint: %s, table_name: %s, datatype_name: %s' % (e.sqlstate, e.hint, e.table_name, e.datatype_name)) raise e $$ LANGUAGE plpythonu; -- cgit v1.2.1