Package: sagemath
Version: 10.9-3
Severity: important
X-Debbugs-Cc: [email protected]

After the recent upgrade of python3-cypari2 to version 2.2.6-1 in Debian Sid,
sagemath experiences a segmentation fault (SignalError: Segmentation fault)
during basic rational number conversions to PARI. This completely breaks
polynomial factorization over number fields, among other core functionalities.
Testing cypari2 on its own outside of SageMath works perfectly, indicating that
the underlying PARI/GP library is functional. The issue stems from an ABI
mismatch/break between the newly compiled python3-cypari2 extensions and
SageMath's pre-existing Cython extensions (convert_sage.pyx / convert_gmp.pyx),
which were compiled against python3-cypari2 2.2.5-1+b1.

A simple, minimal reproduction case inside Sage shows the exact point of
failure within new_gen_from_mpq_t:

---------------------------- cut here -------------------------------------
$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.9, Release Date: 2026-05-04                    │
│ Using Python 3.14.8. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: q = QQ(1)
sage: pari(q)
---------------------------------------------------------------------------
SignalError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 pari(q)

File cypari2/pari_instance.pyx:837, in cypari2.pari_instance.Pari.__call__()

File cypari2/gen.pyx:4786, in cypari2.gen.objtogen()

File /usr/lib/python3/dist-packages/sage/rings/rational.pyx:3805, in 
sage.rings.rational.Rational.__pari__()
   3803     if new_gen_from_rational is None:
   3804         from sage.libs.pari.convert_sage import new_gen_from_rational
-> 3805     return new_gen_from_rational(self)
   3806
   3807 def _interface_init_(self, I=None):
File /usr/lib/python3/dist-packages/sage/libs/pari/convert_sage.pyx:433, in 
sage.libs.pari.convert_sage.new_gen_from_rational()
    431
    432
--> 433 cpdef Gen new_gen_from_rational(Rational self):
    434     """
    435     TESTS::

File /usr/lib/python3/dist-packages/sage/libs/pari/convert_sage.pyx:442, in 
sage.libs.pari.convert_sage.new_gen_from_rational()
    440     -1/2
    441 """
--> 442 return new_gen_from_mpq_t(self.value)
    443
    444

File /usr/lib/python3/dist-packages/sage/libs/pari/convert_gmp.pyx:104, in 
sage.libs.pari.convert_gmp.new_gen_from_mpq_t()
    102     True
    103 """
--> 104 sig_on()
    105 return new_gen(_new_GEN_from_mpq_t(value))
    106

SignalError: Segmentation fault
----------------------------------- cut here -------------------------------
Possible Resolution:
A binary rebuild (binNMU) of sagemath against the current python3-cypari2
(2.2.6-1) in unstable should realign the Cython C-bindings and resolve
the memory corruption.

-- System Information:
Debian Release: forky/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable'), (500, 'testing'), 
(1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 7.2.9-1-siduction-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:de
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages sagemath depends on:
ii  python3       3.14.7-3
ii  python3-sage  10.9-3

Versions of packages sagemath recommends:
ii  sagemath-doc        10.9-3
ii  sagemath-jupyter    10.9-3
ii  sagetex             3.6.1+ds-4
ii  texlive-latex-base  2026.20260911-1

Versions of packages sagemath suggests:
pn  dot2tex      <none>
pn  gap-design   <none>
pn  gap-factint  <none>
pn  gap-grape    <none>
pn  gap-guava    <none>
pn  gap-laguna   <none>
pn  gap-sonata   <none>
pn  gap-toric    <none>

-- no debconf information

Reply via email to