Bug#862595: FTBFS with python3.6

James Clarke jrtc27 at debian.org
Sun May 14 22:22:40 UTC 2017


Source: reprozip
Version: 1.0.9-2
Tags: upstream patch

Hi,
Currently reprozip FTBFS in Ubuntu[1], which has switched to python3.6.
The failure is in the test suite:

> ======================================================================
> ERROR: test_combine (test_reprozip.TestCombine)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/<<PKGBUILDDIR>>/debian/tests/test_reprozip.py", line 403, in test_combine
>     traceutils.combine_traces(traces, target)
>   File "/<<PKGBUILDDIR>>/.pybuild/pythonX.Y_3.6/build/reprozip/traceutils.py", line 237, in combine_traces
>     ''')
> sqlite3.OperationalError: cannot DETACH database within transaction

Looking at the source, reprozip does a series of inserts and deletes
followed by a detach for a list of databases[2]. However, python3.6's
sqlite3 module no longer implicitly commits an open transaction[3] (and
an implicit transaction has been begun in this case), so the DETACH
fails. I have included a patch which fixes this (tested with an artful +
artful-proposed chroot, as well as unstable to check for regressions). I
see there's another conn.commit right after the final DETACH; maybe that
can go now, though it's probably not doing any harm...

Regards,
James

[1] https://launchpadlibrarian.net/319561506/buildlog_ubuntu-artful-amd64.reprozip_1.0.9-2_BUILDING.txt.gz
[2] https://sources.debian.net/src/reprozip/1.0.9-2/reprozip/traceutils.py/#L234 and #L239
[3] https://docs.python.org/3/whatsnew/3.6.html

--- a/reprozip/traceutils.py
+++ b/reprozip/traceutils.py
@@ -230,12 +230,20 @@ def combine_traces(traces, target):
             DELETE FROM maps.map_processes;
             ''')
 
+        # An implicit transaction gets created. Python used to implicitly
+        # commit it, but no longer does as of 3.6, so we have to explicitly
+        # commit before detaching.
+        conn.commit()
+
         # Detach
         conn.execute(
             '''
             DETACH DATABASE trace;
             ''')
 
+    # See above.
+    conn.commit()
+
     conn.execute(
         '''
         DETACH DATABASE maps;



More information about the debian-science-maintainers mailing list