[Debian-med-packaging] Bug#1029580: sepp fails with python3.11: "invalid mode rU"

Steve Langasek steve.langasek at canonical.com
Tue Jan 24 20:12:34 GMT 2023


Package: sepp
Version: 4.5.1+really4.5.1+dfsg-4
Severity: grave
Tags: patch
Justification: renders package unusable
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu lunar ubuntu-patch

Dear maintainers,

sepp fails its autopkgtests with python3.11, revealing a bug in the
software, because it uses a mode flag to open() which has been deprecated
since python 3 and is now obsolete in python 3.11:

[...]
[06:42:37] checkpointing.py (line 68):     INFO: Checkpoint Saved to: /tmp/sepp/output.lmge6vob/checkpoints/dumpl7z66ff0 and linked in /tmp/tmpae0xbm2t.
/usr/lib/python3/dist-packages/sepp/checkpointing.py:75: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  checkpoint_manager.timer.setDaemon(True)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sepp/scheduler.py", line 321, in call_back
    join._tick(job_in)
  File "/usr/lib/python3/dist-packages/sepp/scheduler.py", line 244, in _tick
    self.perform()
  File "/usr/lib/python3/dist-packages/sepp/exhaustive.py", line 196, in perform
    fullExtendedAlignments = self.merge_subalignments()
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/sepp/exhaustive.py", line 181, in merge_subalignments
    ap_alg = ap.read_extendend_alignment_and_relabel_columns(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/sepp/problem.py", line 253, in read_extendend_alignment_and_relabel_columns
    ap_alg.build_extended_alignment(
  File "/usr/lib/python3/dist-packages/sepp/alignment.py", line 555, in build_extended_alignment
    self.read_filepath(base_alignment, "FASTA")
  File "/usr/lib/python3/dist-packages/sepp/alignment.py", line 294, in read_filepath
    file_obj = open(filename, 'rU')
               ^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
ERROR
[...]

  (https://ci.debian.net/data/autopkgtest/unstable/amd64/s/sepp/30285435/log.gz)

This also impacts invocations of sepp in other autopkgtests
(q2-fragment-insertion; q2-sample-classifier) so I'm confident is reporting
this as 'grave'.

I've applied the attached straightforward patch in Ubuntu to fix the
regression there.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru sepp-4.5.1+really4.5.1+dfsg/debian/patches/open-U-obsolete.patch sepp-4.5.1+really4.5.1+dfsg/debian/patches/open-U-obsolete.patch
--- sepp-4.5.1+really4.5.1+dfsg/debian/patches/open-U-obsolete.patch	1969-12-31 16:00:00.000000000 -0800
+++ sepp-4.5.1+really4.5.1+dfsg/debian/patches/open-U-obsolete.patch	2023-01-24 12:07:06.000000000 -0800
@@ -0,0 +1,52 @@
+Description: Drop obsolete "U" mode passed to open()
+ The "U" mode has been deprecated in python since python3 and has had no
+ effect.  In python 3.11, it is now disallowed.  Drop this mode flag that
+ causes runtime failures.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Update: 2023-01-24
+Forwarded: no
+
+Index: sepp-4.5.1+really4.5.1+dfsg/sepp/alignment.py
+===================================================================
+--- sepp-4.5.1+really4.5.1+dfsg.orig/sepp/alignment.py
++++ sepp-4.5.1+really4.5.1+dfsg/sepp/alignment.py
+@@ -108,7 +108,7 @@
+     file_obj = None
+     if isinstance(src, str):
+         try:
+-            file_obj = open(src, "rU")
++            file_obj = open(src, "r")
+         except IOError:
+             print(("The file `%s` does not exist, exiting gracefully" % src))
+     elif isinstance(src, filetypes):
+@@ -291,7 +291,7 @@
+         If duplicate sequence names are encountered then the old name will
+         be replaced.
+         """
+-        file_obj = open(filename, 'rU')
++        file_obj = open(filename, 'r')
+         return self.read_file_object(file_obj, file_format=file_format)
+ 
+     def read_file_object(self, file_obj, file_format='FASTA'):
+@@ -582,7 +582,7 @@
+         columns. Labels insertion columns with special labels and labels the
+         rest of columns (i.e. original columns) sequentially.
+         """
+-        handle = open(path, 'rU')
++        handle = open(path, 'r')
+         insertions = None
+         if aformat.lower() == "stockholm":
+             insertions = self._read_sto(handle)
+Index: sepp-4.5.1+really4.5.1+dfsg/sepp/tree.py
+===================================================================
+--- sepp-4.5.1+really4.5.1+dfsg.orig/sepp/tree.py
++++ sepp-4.5.1+really4.5.1+dfsg/sepp/tree.py
+@@ -314,7 +314,7 @@
+ 
+     def read_tree_from_file(self, treefile, file_format):
+         dataset = Dataset()
+-        dataset.read(open(treefile, 'rU'), schema=file_format)
++        dataset.read(open(treefile, 'r'), schema=file_format)
+         dendropy_tree = dataset.trees_blocks[0][0]
+         self._tree = dendropy_tree
+         self.n_leaves = self.count_leaves()
diff -Nru sepp-4.5.1+really4.5.1+dfsg/debian/patches/series sepp-4.5.1+really4.5.1+dfsg/debian/patches/series
--- sepp-4.5.1+really4.5.1+dfsg/debian/patches/series	2022-02-05 13:17:58.000000000 -0800
+++ sepp-4.5.1+really4.5.1+dfsg/debian/patches/series	2023-01-24 12:05:55.000000000 -0800
@@ -7,3 +7,4 @@
 using_python3_interpreter.patch
 hmmbuild_path_for_testUPP.patch
 py310_collections_import.patch
+open-U-obsolete.patch


More information about the Debian-med-packaging mailing list