mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-21 05:46:59 +08:00
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:
@ -14,7 +14,7 @@ REGRESS := $(foreach test,$(REGRESS),$(if $(filter $(test),$(REGRESS_PLPYTHON3_M
|
||||
pgregress-python3-mangle:
|
||||
$(MKDIR_P) sql/python3 expected/python3 results/python3
|
||||
for file in $(patsubst %,$(srcdir)/sql/%.sql,$(REGRESS_PLPYTHON3_MANGLE)) $(patsubst %,$(srcdir)/expected/%*.out,$(REGRESS_PLPYTHON3_MANGLE)); do \
|
||||
sed -e 's/except \([[:alpha:]][[:alpha:].]*\), *\([[:alpha:]][[:alpha:]]*\):/except \1 as \2:/g' \
|
||||
sed \
|
||||
-e "s/<type 'exceptions\.\([[:alpha:]]*\)'>/<class '\1'>/g" \
|
||||
-e "s/<type 'long'>/<class 'int'>/g" \
|
||||
-e "s/\([0-9][0-9]*\)L/\1/g" \
|
||||
|
||||
Reference in New Issue
Block a user