Your message dated Tue, 02 Jun 2026 16:05:25 +0000
with message-id <[email protected]>
and subject line Bug#1138218: fixed in python-cobra 0.31.1-1
has caused the Debian Bug report #1138218,
regarding python-cobra: infinite recursion and GPR deepcopy failures on Python 
3.14
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1138218: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1138218
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-cobra
Version: 0.29.1-5
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
X-Debbugs-Cc: [email protected], [email protected], 
[email protected], [email protected]
User: [email protected]
Usertags: origin-ubuntu stonking ubuntu-patch
User: [email protected]
Usertags: amd64
User: [email protected]
Usertags: arm64 armhf
User: [email protected]
Usertags: i386
User: [email protected]
Usertags: ppc64el

Dear Maintainer,

In Python 3.14, two related regressions were introduced in cobrapy:

1. `deepcopy(super(Reaction, self), memo)` no longer short-circuits via the
   memo dict, causing `Reaction.__deepcopy__` to call itself indefinitely and
   raise a RecursionError (LP: #2154412,
   https://github.com/opencobra/cobrapy/issues/1474).

2. `ast.Module.__reduce__` now returns three positional arguments, which
   `GPR.__init__` cannot accept, causing deepcopy of any model containing GPR
   objects to fail with a TypeError (LP: #2154413,
   https://github.com/opencobra/cobrapy/issues/1475).

Both failures are triggered by the presence of the custom `__copy__` and
`__deepcopy__` overrides on `Reaction`. Removing them lets Python's default
copy machinery handle `Reaction` and the `GPR` objects it references correctly,
without requiring any manual workaround. The fix is minimal and has been
verified against the upstream test suite. Upstream has a fix PR merged
and should be available soon in debian after a new release:
https://github.com/opencobra/cobrapy/pull/1471

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/python-314.patch: remove Reaction.__copy__ and __deepcopy__,
    fixing infinite recursion and GPR deepcopy failures on Python 3.14
    (LP: #2154412, LP: #2154413)


Thanks for considering the patch.

-- System Information:
Debian Release: forky/sid
  APT prefers resolute-updates
  APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 
'resolute')
Architecture: amd64 (x86_64)

Kernel: Linux 7.0.0-15-generic (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru python-cobra-0.29.1/debian/patches/python-314.patch 
python-cobra-0.29.1/debian/patches/python-314.patch
--- python-cobra-0.29.1/debian/patches/python-314.patch 1970-01-01 
05:30:00.000000000 +0530
+++ python-cobra-0.29.1/debian/patches/python-314.patch 2026-05-28 
18:00:33.000000000 +0530
@@ -0,0 +1,45 @@
+Description: Remove Reaction.__copy__ and __deepcopy__, broken in Python 3.14
+ The super()-based overrides cause infinite recursion and GPR deepcopy
+ failures in Python 3.14. Removing them lets the default copy machinery
+ handle both correctly.
+Author: Christian Diener <[email protected]>
+Origin: upstream, 
https://github.com/opencobra/cobrapy/commit/c4a09043c0b378bfbecf597d89020b85eafb5737
+Bug: https://github.com/opencobra/cobrapy/issues/1474
+Bug: https://github.com/opencobra/cobrapy/issues/1475
+Last-Update: 2026-05-29
+--- a/src/cobra/core/reaction.py
++++ b/src/cobra/core/reaction.py
+@@ -246,33 +246,6 @@
+         if self.flux_expression is not None:
+             set_objective(self.model, {self: value}, additive=True)
+ 
+-    def __copy__(self) -> "Reaction":
+-        """Copy the Reaction.
+-
+-        Returns
+-        -------
+-        Reaction
+-            A new reaction that is a copy of the original reaction.
+-        """
+-        cop = copy(super(Reaction, self))
+-        return cop
+-
+-    def __deepcopy__(self, memo: dict) -> "Reaction":
+-        """Copy the reaction with memo.
+-
+-        Parameters
+-        ----------
+-        memo: dict
+-            Automatically passed parameter.
+-
+-        Returns
+-        -------
+-        Reaction
+-            A new reaction that is a deep copy of the original reaction with 
memo.
+-        """
+-        cop = deepcopy(super(Reaction, self), memo)
+-        return cop
+-
+     @staticmethod
+     def _check_bounds(lb: float, ub: float) -> None:
+         """Check if the lower and upper bounds are valid.
diff -Nru python-cobra-0.29.1/debian/patches/series 
python-cobra-0.29.1/debian/patches/series
--- python-cobra-0.29.1/debian/patches/series   2026-02-27 19:43:42.000000000 
+0530
+++ python-cobra-0.29.1/debian/patches/series   2026-05-28 18:00:33.000000000 
+0530
@@ -6,3 +6,4 @@
 remove-appdirs.patch
 a2b9d00a04b85b8c8eb12e4deba29ce2147896cf.patch
 pr1452.patch
+python-314.patch

--- End Message ---
--- Begin Message ---
Source: python-cobra
Source-Version: 0.31.1-1
Done: Andreas Tille <[email protected]>

We believe that the bug you reported is fixed in the latest version of
python-cobra, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andreas Tille <[email protected]> (supplier of updated python-cobra package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 02 Jun 2026 17:28:56 +0200
Source: python-cobra
Architecture: source
Version: 0.31.1-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Med Packaging Team 
<[email protected]>
Changed-By: Andreas Tille <[email protected]>
Closes: 1138218
Changes:
 python-cobra (0.31.1-1) unstable; urgency=medium
 .
   * Team upload.
 .
   [ Ujjwal Sarswat ]
   * Fix infinite recursion and GPR deepcopy failures on Python 3.14
     Closes: #1138218
 .
   [ Andreas Tille ]
   * DEP3
   * New upstream version
   * Standards-Version: 4.7.4 (routine-update)
   * Drop alien lintiantag
     python-package-depends-on-package-from-other-python-variant
   * Drop unknown architecture powerpcspe
   * Build-Depends: pybuild-plugin-pyproject
Checksums-Sha1:
 be88a3068176c7bb057eb4631311545ce7d96248 3077 python-cobra_0.31.1-1.dsc
 7fc4a78b22778d92c8f78583eca430fd072e7e09 3657267 
python-cobra_0.31.1.orig.tar.gz
 96dd3dd274d901b5afc081137d15f82ae6805167 11072 
python-cobra_0.31.1-1.debian.tar.xz
 705c6d1788bcda11cca3b7abdc2d8011da9c0719 12293 
python-cobra_0.31.1-1_amd64.buildinfo
Checksums-Sha256:
 340ef899e598f9632b95bef31834ece940e5cb5ffbb7e5843cc9473fcbb859cd 3077 
python-cobra_0.31.1-1.dsc
 0ae936b414d7fd905a75493630d506e408720bd21b2f5318b370a6c555666a5c 3657267 
python-cobra_0.31.1.orig.tar.gz
 0265072178b1eef849214b5d26c7cae7db7abbbe91412b2fae6ac598403bb9b1 11072 
python-cobra_0.31.1-1.debian.tar.xz
 11e4c1bb6200b5aed631e3fa01848fc4c2e73524049dc0569eb343dcf51eb076 12293 
python-cobra_0.31.1-1_amd64.buildinfo
Files:
 ec6f1bee880002d5c81e89ec44b7fee8 3077 python optional python-cobra_0.31.1-1.dsc
 467af25cdd05df3b773448976f1e6e80 3657267 python optional 
python-cobra_0.31.1.orig.tar.gz
 e0af1d6703818ebe5ac3134b26c5706d 11072 python optional 
python-cobra_0.31.1-1.debian.tar.xz
 8c85e426144cbfb25b1cc119745ff9ac 12293 python optional 
python-cobra_0.31.1-1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEE8fAHMgoDVUHwpmPKV4oElNHGRtEFAmoe+jURHHRpbGxlQGRl
Ymlhbi5vcmcACgkQV4oElNHGRtGeag/8Dj5YVeSiOGP4Vq62CL9+jTfdMiWsyGCq
qK+LDnOq/0hzUcHymmNEHe1fRouYcfHUNYvcG3MOinGcTEgFLRt/cHpSlhl61HlF
ydyDir3sCUT2LyYQA5rmJoD6aqTbBUK/lNJFYI4n+MU7Il2ktB+8F5GZAvmHb1B6
q7mvKGoAm+QyXYgMe+oHSKrGOlQeHpVjZKP3gA/x+rH+GSUZTATUU5q01wuMmyyx
6mkmBYdCvx2AO+8xr/vRXNKGJASA4uBWeCU9dRYrW8wgNF3JhvT+FZqMQDgzBAMv
0kWr4gRCr9/e8uzM8imrZk5g56Krd8jxOcroUva7ea2Cbx1pwcKBKvBWj66fgWJ4
+tljXgkXyMj+mX675U6er5mIzPN3wAma3A9b6oAuIthhJC5sivVilmf9mO21uZZA
fp73Hg74hzWoYkpCNURo2gGQLhTt5LsaZz41VnVcsYnse5bPEeZqrVLoFUJSkIr8
ceqIyccYmLGpM/APbAOfDZSVI8k6FKx/oHYk6I4vYO0rC/S1Njoqa2vKN4NMDUCp
U6dg41x9QR+WBT89+qFQOztPM6hOPybm5541P0s9JRQ6Rgmj3TqJdW5FQf4wdeMq
XZ6Ok5oaAMKbICluE6soKMHOhZ45PvxqcbVHMC7fqkN4Gx1y795ZIF/DPu0Mk54x
ow3Wqgv+cvQ=
=ziKD
-----END PGP SIGNATURE-----

Attachment: pgpAT6XFgmeK9.pgp
Description: PGP signature


--- End Message ---

Reply via email to