From 45223fd9cefe483daa4af7740f15c004486636eb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
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 <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com
---
 src/pl/plpython/sql/plpython_spi.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/pl/plpython/sql/plpython_spi.sql')

diff --git a/src/pl/plpython/sql/plpython_spi.sql b/src/pl/plpython/sql/plpython_spi.sql
index fcf049cb66..dd77833ed5 100644
--- a/src/pl/plpython/sql/plpython_spi.sql
+++ b/src/pl/plpython/sql/plpython_spi.sql
@@ -31,7 +31,7 @@ CREATE FUNCTION spi_prepared_plan_test_one(a text) RETURNS text
 try:
 	rv = plpy.execute(SD["myplan"], [a])
 	return "there are " + str(rv[0]["count"]) + " " + str(a) + "s"
-except Exception, ex:
+except Exception as ex:
 	plpy.error(str(ex))
 return None
 '
@@ -45,7 +45,7 @@ CREATE FUNCTION spi_prepared_plan_test_two(a text) RETURNS text
 try:
 	rv = SD["myplan"].execute([a])
 	return "there are " + str(rv[0]["count"]) + " " + str(a) + "s"
-except Exception, ex:
+except Exception as ex:
 	plpy.error(str(ex))
 return None
 '
@@ -60,7 +60,7 @@ try:
 	rv = plpy.execute(SD["myplan"])
 	if len(rv):
 		return rv[0]["count"]
-except Exception, ex:
+except Exception as ex:
 	plpy.error(str(ex))
 return None
 '
-- 
cgit v1.2.1

