Dear maintainer,

I've prepared an NMU for cyvcf2 (versioned as 0.30.11-1.1). The diff
is attached to this message.

Also filed as https://salsa.debian.org/med-team/cyvcf2/-/merge_requests/1

Regards,

SR
diff -Nru cyvcf2-0.30.11/debian/changelog cyvcf2-0.30.11/debian/changelog
--- cyvcf2-0.30.11/debian/changelog	2021-08-15 07:35:52.000000000 -0400
+++ cyvcf2-0.30.11/debian/changelog	2021-11-21 08:38:57.000000000 -0400
@@ -1,3 +1,11 @@
+cyvcf2 (0.30.11-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Patch: Python 3.10 support - avoid a regression in gzip file handles
+    (Closes: #1000317)
+
+ -- Stefano Rivera <stefa...@debian.org>  Sun, 21 Nov 2021 08:38:57 -0400
+
 cyvcf2 (0.30.11-1) unstable; urgency=medium
 
   * Fix watch URL
diff -Nru cyvcf2-0.30.11/debian/patches/python-3.10.patch cyvcf2-0.30.11/debian/patches/python-3.10.patch
--- cyvcf2-0.30.11/debian/patches/python-3.10.patch	1969-12-31 20:00:00.000000000 -0400
+++ cyvcf2-0.30.11/debian/patches/python-3.10.patch	2021-11-21 08:38:57.000000000 -0400
@@ -0,0 +1,46 @@
+From: Stefano Rivera <stef...@rivera.za.net>
+Date: Sun, 21 Nov 2021 08:29:40 -0400
+Subject: Avoid a Python 3.10 regression in iterating GzipFiles
+
+Open the file with a context manager, so we're holding onto a reference to it, for the lifetime of the iteration.
+
+This avoids hitting https://bugs.python.org/issue45475 which affects python3.10 3.10.0-4 in Debian.
+
+Bug-Debian: https://bugs.debian.org/1000317
+Forwarded: https://github.com/brentp/cyvcf2/pull/225
+---
+ cyvcf2/tests/test_reader.py | 21 +++++++++++----------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/cyvcf2/tests/test_reader.py b/cyvcf2/tests/test_reader.py
+index 76cb9f8..f81b920 100644
+--- a/cyvcf2/tests/test_reader.py
++++ b/cyvcf2/tests/test_reader.py
+@@ -456,16 +456,17 @@ def test_var_type():
+ def _get_line_for(v):
+     import gzip
+ 
+-    for i, line in enumerate(gzip.open(VCF_PATH), start=1):
+-        line = line.decode()
+-        if line[0] == "#": continue
+-        toks = line.strip().split("\t")
+-        if not (toks[0] == v.CHROM and int(toks[1]) == v.POS): continue
+-        if toks[3] != v.REF: continue
+-        if toks[4] not in v.ALT: continue
+-        return toks
+-    else:
+-        raise Exception("not found")
++    with gzip.open(VCF_PATH) as f:
++        for i, line in enumerate(f, start=1):
++            line = line.decode()
++            if line[0] == "#": continue
++            toks = line.strip().split("\t")
++            if not (toks[0] == v.CHROM and int(toks[1]) == v.POS): continue
++            if toks[3] != v.REF: continue
++            if toks[4] not in v.ALT: continue
++            return toks
++        else:
++            raise Exception("not found")
+ 
+ 
+ def _get_samples(v):
diff -Nru cyvcf2-0.30.11/debian/patches/series cyvcf2-0.30.11/debian/patches/series
--- cyvcf2-0.30.11/debian/patches/series	2021-08-08 07:32:31.000000000 -0400
+++ cyvcf2-0.30.11/debian/patches/series	2021-11-21 08:38:57.000000000 -0400
@@ -1,2 +1,3 @@
 add_htslib_link_dependency.patch
 i386.patch
+python-3.10.patch

Reply via email to