[med-svn] [Git][med-team/python-pysam][master] 3 commits: preserve-stdout-from-gc.patch: new.
Étienne Mollier (@emollier)
gitlab at salsa.debian.org
Mon Nov 17 18:39:55 GMT 2025
Étienne Mollier pushed to branch master at Debian Med / python-pysam
Commits:
2550326b by Étienne Mollier at 2025-11-17T19:35:33+01:00
preserve-stdout-from-gc.patch: new.
This patch originates from upstream and fixes an old issue spotted on
i386 architecture some time ago.
- - - - -
30a23010 by Étienne Mollier at 2025-11-17T19:36:54+01:00
skip-test-on-32-bit.patch: drop now unneeded segment.
The original skip hunk of the patch is now fixed by the patch
preserve-stdout-from-gc.patch.
- - - - -
3a897a6d by Étienne Mollier at 2025-11-17T19:38:08+01:00
d/changelog: initialise the changelog.
- - - - -
4 changed files:
- debian/changelog
- + debian/patches/preserve-stdout-from-gc.patch
- debian/patches/series
- debian/patches/skip-test-on-32-bit.patch
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+python-pysam (0.23.3+ds-3) UNRELEASED; urgency=medium
+
+ * preserve-stdout-from-gc.patch: new.
+ This patch originates from upstream and fixes an old issue spotted on
+ i386 architecture some time ago.
+ * skip-test-on-32-bit.patch: drop now unneeded segment.
+ The original skip hunk of the patch is now fixed by the patch
+ preserve-stdout-from-gc.patch.
+
+ -- Étienne Mollier <emollier at debian.org> Mon, 17 Nov 2025 19:37:54 +0100
+
python-pysam (0.23.3+ds-2) unstable; urgency=medium
* skip-test-on-32-bit.patch: skip further tests.
=====================================
debian/patches/preserve-stdout-from-gc.patch
=====================================
@@ -0,0 +1,69 @@
+Description: Ensure stdout filename object is not garbage-collected while in use in C
+ Store the output of `force_bytes(stdout_f)` in a live object to ensure
+ it is not garbage-collected before it is used within samtools_dispatch().
+ This fixes a test failure on i386 (SamtoolsTest/PysamTest for calmd).
+Author: John Marshall <jmarshall at hey.com>
+Bug: https://github.com/pysam-developers/pysam/issues/1367
+Applied-Upstream: d6fbe29d51049cee8adc23059f82885c01cb3ac5
+Last-Update: 2025-11-15
+
+diff --git a/pysam/libcutils.pyx b/pysam/libcutils.pyx
+index 7a03f3c4..72732e84 100644
+--- a/pysam/libcutils.pyx
++++ b/pysam/libcutils.pyx
+@@ -327,14 +327,11 @@ def _pysam_dispatch(collection,
+ # redirect stdout to file
+ if save_stdout:
+ stdout_f = save_stdout
+- stdout_h = c_open(force_bytes(stdout_f),
+- O_WRONLY|O_CREAT|O_TRUNC, 0666)
++ stdout_f_bytes = force_bytes(stdout_f)
++ stdout_h = c_open(stdout_f_bytes, O_WRONLY|O_CREAT|O_TRUNC, 0666)
+ if stdout_h == -1:
+ raise OSError_from_errno("Could not redirect standard output", stdout_f)
+
+- samtools_set_stdout_fn(force_bytes(stdout_f))
+- bcftools_set_stdout_fn(force_bytes(stdout_f))
+-
+ elif catch_stdout:
+ stdout_h, stdout_f = tempfile.mkstemp()
+ MAP_STDOUT_OPTIONS = {
+@@ -360,13 +357,14 @@ def _pysam_dispatch(collection,
+
+ if stdout_option is not None and not is_usage:
+ os.close(stdout_h)
+- samtools_set_stdout_fn(force_bytes(stdout_f))
+- bcftools_set_stdout_fn(force_bytes(stdout_f))
++ stdout_f_bytes = force_bytes(stdout_f)
+ args.extend(stdout_option.format(stdout_f).split(" "))
+ stdout_h = c_open(b"/dev/null", O_WRONLY)
++ else:
++ stdout_f_bytes = None
++
+ else:
+- samtools_set_stdout_fn("-")
+- bcftools_set_stdout_fn("-")
++ stdout_f_bytes = b"-"
+ if catch_stdout is None: stdout_h = c_dup(STDOUT_FILENO)
+ else: stdout_h = c_open(b"/dev/null", O_WRONLY)
+
+@@ -397,15 +395,19 @@ def _pysam_dispatch(collection,
+
+ # call samtools/bcftools
+ if collection == b"samtools":
++ if stdout_f_bytes is not None: samtools_set_stdout_fn(stdout_f_bytes)
+ samtools_set_stdout(stdout_h)
+ samtools_set_stderr(stderr_h)
+ retval = samtools_dispatch(n + 2, cargs)
++ samtools_set_stdout_fn(NULL)
+ samtools_close_stdout()
+ samtools_close_stderr()
+ elif collection == b"bcftools":
++ if stdout_f_bytes is not None: bcftools_set_stdout_fn(stdout_f_bytes)
+ bcftools_set_stdout(stdout_h)
+ bcftools_set_stderr(stderr_h)
+ retval = bcftools_dispatch(n + 2, cargs)
++ bcftools_set_stdout_fn(NULL)
+ bcftools_close_stdout()
+ bcftools_close_stderr()
+ else:
=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
skip_test_remote.patch
clean_less
skip-test-on-32-bit.patch
+preserve-stdout-from-gc.patch
=====================================
debian/patches/skip-test-on-32-bit.patch
=====================================
@@ -2,37 +2,8 @@ Description: Attempt skipping failing test on 32-bit
Author: Nilesh Patra <nilesh at debian.org>
Bug: https://github.com/pysam-developers/pysam/issues/1367
Reviewed-By: Étienne Mollier <emollier at debian.org>
-Last-Update: 2025-11-14
+Last-Update: 2025-11-17
---
---- python-pysam.orig/tests/samtools_test.py
-+++ python-pysam/tests/samtools_test.py
-@@ -20,6 +20,7 @@
- check_samtools_view_equal, get_temp_filename, force_bytes, WORKDIR, \
- make_data_files, BAM_DATADIR
-
-+import platform
-
- def setUpModule():
- make_data_files(BAM_DATADIR)
-@@ -86,7 +87,7 @@
- # TODO: fixmate behaviour changed in 1.21
- #"fixmate ex1.bam %(out)s_ex1.fixmate.bam",
- "flagstat ex1.bam > %(out)s_ex1.flagstat",
-- "calmd ex1.bam ex1.fa > %(out)s_ex1.calmd.bam",
-+ #"calmd ex1.bam ex1.fa > %(out)s_ex1.calmd.bam",
- # use -s option, otherwise the following error in samtools 1.2:
- # Samtools-htslib-API: bam_get_library() not yet implemented
- # causes downstream problems
-@@ -112,6 +113,9 @@
- # ("addreplacerg -r 'RG\tID:ga\tSM:hs' ex1.bam > %(out)s_ex1.addreplacerg",
- ]
-
-+ if platform.architecture()[0] == '64bit':
-+ statements.append("calmd ex1.bam ex1.fa > %(out)s_ex1.calmd.bam")
-+
- map_command = {
- }
-
--- python-pysam.orig/tests/compile_test.py
+++ python-pysam/tests/compile_test.py
@@ -8,6 +8,7 @@
View it on GitLab: https://salsa.debian.org/med-team/python-pysam/-/compare/6fd1e17f8ebef366d52a63b7a274bdd5a7330346...3a897a6dfd8d06ba51e078d06ce013ef9dd21be0
--
View it on GitLab: https://salsa.debian.org/med-team/python-pysam/-/compare/6fd1e17f8ebef366d52a63b7a274bdd5a7330346...3a897a6dfd8d06ba51e078d06ce013ef9dd21be0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20251117/5fc4bcbb/attachment-0001.htm>
More information about the debian-med-commit
mailing list