Skip to content

Commit b55413d

Browse files
committed
Modernize Python exception syntax in documentation
Change the exception syntax used in the documentation to use the more current except Exception as ex: rather than the old except Exception, ex: We keep the old syntax in the test code since Python <2.6 is still supported there, but the documentation might as well use the modern syntax.
1 parent 0ce3873 commit b55413d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/src/sgml/plpython.sgml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ except spiexceptions.DivisionByZero:
12271227
return "denominator cannot equal zero"
12281228
except spiexceptions.UniqueViolation:
12291229
return "already have that fraction"
1230-
except plpy.SPIError, e:
1230+
except plpy.SPIError as e:
12311231
return "other error, SQLSTATE %s" % e.sqlstate
12321232
else:
12331233
return "fraction inserted"
@@ -1274,7 +1274,7 @@ CREATE FUNCTION transfer_funds() RETURNS void AS $$
12741274
try:
12751275
plpy.execute("UPDATE accounts SET balance = balance - 100 WHERE account_name = 'joe'")
12761276
plpy.execute("UPDATE accounts SET balance = balance + 100 WHERE account_name = 'mary'")
1277-
except plpy.SPIError, e:
1277+
except plpy.SPIError as e:
12781278
result = "error transferring funds: %s" % e.args
12791279
else:
12801280
result = "funds transferred correctly"
@@ -1306,7 +1306,7 @@ try:
13061306
with plpy.subtransaction():
13071307
plpy.execute("UPDATE accounts SET balance = balance - 100 WHERE account_name = 'joe'")
13081308
plpy.execute("UPDATE accounts SET balance = balance + 100 WHERE account_name = 'mary'")
1309-
except plpy.SPIError, e:
1309+
except plpy.SPIError as e:
13101310
result = "error transferring funds: %s" % e.args
13111311
else:
13121312
result = "funds transferred correctly"
@@ -1357,7 +1357,7 @@ try:
13571357
raise
13581358
else:
13591359
subxact.exit(None, None, None)
1360-
except plpy.SPIError, e:
1360+
except plpy.SPIError as e:
13611361
result = "error transferring funds: %s" % e.args
13621362
else:
13631363
result = "funds transferred correctly"

0 commit comments

Comments
 (0)