diff --git a/debian/patches/fix-ftbfs-python.patch b/debian/patches/fix-ftbfs-python.patch
new file mode 100644
index 00000000..a7910d07
--- /dev/null
+++ b/debian/patches/fix-ftbfs-python.patch
@@ -0,0 +1,22 @@
+Description: Replace obsolete Python 2 API calls in SWIG bindings
+Replace PyString_FromString() and PyInt_FromLong() with the corresponding
+ Python 3 API functions PyUnicode_FromString() and PyLong_FromLong().
+ This is required to build the Python bindings with current Python versions.
+Author: Tobias Frost <tobi@debian.org>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/python/med_common.i
++++ b/python/med_common.i
+@@ -13,8 +13,8 @@
+       /* fprintf(stderr,"Code erreur MED : %2d\n",result); */
+       /* SWIG_exception(SWIG_RuntimeError,"Error returned from MEDfichier API (funcname)."); */
+       PyObject* exobj = PyTuple_New(2);
+-      PyTuple_SetItem(exobj,0,PyString_FromString("Error returned from MEDfichier API (funcname)."));
+-      PyTuple_SetItem(exobj,1,PyInt_FromLong((long) result));
++      PyTuple_SetItem(exobj,0,PyUnicode_FromString("Error returned from MEDfichier API (funcname)."));
++      PyTuple_SetItem(exobj,1,PyLong_FromLong((long) result));
+       SWIG_Python_SetErrorObj(PyExc_RuntimeError,exobj);
+       /* PyErr_SetString(PyExc_Exception, str(result));  */
+       return NULL;
+
diff --git a/debian/patches/fix-tests.patch b/debian/patches/fix-tests.patch
new file mode 100644
index 00000000..824e57d0
--- /dev/null
+++ b/debian/patches/fix-tests.patch
@@ -0,0 +1,22 @@
+Description: Close MED file in Test_MEDnStructElement
+ Explicitly close the MED file opened by Test_MEDnStructElement before
+ exiting the test. This prevents HDF5 from encountering the still-open
+ file handle during library shutdown.
+ This fixes the infinite loop experienced during the test suite.
+Author: Tobias Frost <tobi@debian.org>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/tests/unittests/c/Test_MEDnStructElement.c
++++ b/tests/unittests/c/Test_MEDnStructElement.c
+@@ -47,6 +47,10 @@
+ 
+   ISCRUTE(_nstructelement);
+ 
++  if (MEDfileClose(_fid) < 0)
++    _ret = -1;
++
++
+   return _ret;
+ 
+ }
diff --git a/debian/patches/relax-hdf5-version-check.patch b/debian/patches/relax-hdf5-version-check.patch
new file mode 100644
index 00000000..75b2680f
--- /dev/null
+++ b/debian/patches/relax-hdf5-version-check.patch
@@ -0,0 +1,22 @@
+Description: Relax HDF5 version compatibility check
+ The HDF5 compatibility check incorrectly rejects HDF5 library versions
+ whose minor version is newer than the minimum reference version, even
+ when the complete HDF5 version is at or above the required version.
+ Compare the complete HDF5 version number instead of checking the minor
+ version separately.
+Author: Tobias Frost <tobi@debian.org>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/ci/MEDfileCompatibility.c
++++ b/src/ci/MEDfileCompatibility.c
+@@ -70,7 +70,7 @@
+   _hversionMMR=10000*_hmajeur+100*_hmineur+_hrelease;
+   /* ISCRUTE(_hversionMMR); */
+   /* ISCRUTE(HDF_VERSION_NUM_REF); */
+-  if ( (_hversionMMR >= HDF_VERSION_NUM_REF) && (_hmineur >= HDF_VERSION_MINOR_REF) ) *hdfok = MED_TRUE;
++  if ( _hversionMMR >= HDF_VERSION_NUM_REF ) *hdfok = MED_TRUE;
+ 
+   /* TODO : Vérifier si la version mineure HDF du fichier est supérieure
+      à la version mineure de la bibliothèque HDF utilisée :
+
diff --git a/debian/patches/series b/debian/patches/series
index e891316e..51b0f0d4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,6 @@ hdf5-1.14.patch
 fix-swig-deprecated-python.patch
 swig-4.3.patch
 incompatible-pointer-types.patch
+fix-ftbfs-python.patch
+fix-tests.patch
+relax-hdf5-version-check.patch
