plpython subtransaction test failure with Python 3.10

From: Honza Horak <hhorak(at)redhat(dot)com>
To: "Hackers, Pg" <pgsql-hackers(at)postgresql(dot)org>
Subject: plpython subtransaction test failure with Python 3.10
Date: 2021-05-11 21:23:18
Message-ID: CA+HKMWPk0bMUvwV7x4pYxbtNMCVvpBVi=o=S96MFYTr_WKZ7UA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Originally reported as https://bugzilla.redhat.com/show_bug.cgi?id=1959080
during early integration testing of Python 3.10 done in Fedora.

The test failed because Python 3.10 reports the traceback a bit differently:

cat postgresql-13.2/src/pl/plpython/regression.diffs
diff -U3
postgresql-13.2/src/pl/plpython/expected/python3/plpython_subtransaction.out
/builddir/build/BUILD/postgresql-13.2/src/pl/plpython/results/python3/plpython_subtransaction.out
---
postgresql-13.2/src/pl/plpython/expected/python3/plpython_subtransaction.out
2021-05-11 17:05:24.116431883 +0200
+++
postgresql-13.2/src/pl/plpython/results/python3/plpython_subtransaction.out
2021-05-11 17:05:26.689459542 +0200
@@ -224,8 +224,8 @@
SELECT subtransaction_exit_subtransaction_in_with();
ERROR: ValueError: this subtransaction has already been exited
CONTEXT: Traceback (most recent call last):
- PL/Python function "subtransaction_exit_subtransaction_in_with", line 3,
in <module>
- s.__exit__(None, None, None)
+ PL/Python function "subtransaction_exit_subtransaction_in_with", line 2,
in <module>
+ with plpy.subtransaction() as s:
PL/Python function "subtransaction_exit_subtransaction_in_with"
-- Make sure we don't get a "current transaction is aborted" error
SELECT 1 as test;

The attached patch makes the traceback look the same in Python 3.10 and
also in earlier versions.

Regards,
Honza

Attachment Content-Type Size
0001-Fix-subtransaction-test-for-Python-3.10.patch text/x-patch 2.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-05-11 21:24:36 Re: PG 14 release notes, first draft
Previous Message Bruce Momjian 2021-05-11 21:23:10 Re: PG 14 release notes, first draft