Обсуждение: plpython subtransaction test failure with Python 3.10

Поиск
Список
Период
Сортировка

plpython subtransaction test failure with Python 3.10

От
Honza Horak
Дата:
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
Вложения