Ticket #11339: bug11339a.patch

File bug11339a.patch, 2.6 KB (added by gagern, 10 years ago)

Workaround patch

  • sage/libs/singular/groebner_strategy.pxd

    Work around ticket #11339.
    2011-06-03 Martin von Gagern
    http://trac.sagemath.org/sage_trac/ticket/11339
    
    diff -r ce324e28c333 sage/libs/singular/groebner_strategy.pxd
    a b  
     1from cpython.ref cimport PyObject
    12from sage.libs.singular.decl cimport skStrategy
    23
    34from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular
     
    78cdef class GroebnerStrategy(SageObject):
    89    cdef skStrategy *_strat
    910    cdef MPolynomialRing_libsingular _parent
     11    cdef PyObject *_parent_for_dealloc
    1012    cdef object _ideal
    1113
    1214    cpdef MPolynomial_libsingular normal_form(self, MPolynomial_libsingular p)
  • sage/libs/singular/groebner_strategy.pyx

    diff -r ce324e28c333 sage/libs/singular/groebner_strategy.pyx
    a b  
    2020cdef extern from "":
    2121    int unlikely(int)
    2222    int likely(int)
     23from cpython.ref cimport (PyObject, Py_XINCREF, Py_XDECREF)
    2324
    2425from sage.libs.singular.decl cimport ideal, ring, poly, currRing
    2526from sage.libs.singular.decl cimport rChangeCurrRing
     
    100101
    101102        cdef MPolynomialRing_libsingular R = <MPolynomialRing_libsingular>L.ring()
    102103        self._parent = R
     104        Py_XDECREF(self._parent_for_dealloc)
     105        self._parent_for_dealloc = <PyObject*>R
     106        Py_XINCREF(self._parent_for_dealloc)
    103107
    104108        if not R.term_order().is_global():
    105109            raise NotImplementedError("The local case is not implemented yet.")
     
    142146            sage: del strat
    143147        """
    144148        cdef ring *oldRing = NULL
     149        cdef MPolynomialRing_libsingular parent
    145150        if self._strat:
     151            parent = (
     152                <MPolynomialRing_libsingular>self._parent_for_dealloc)
    146153            omfree(self._strat.sevS)
    147154            omfree(self._strat.ecartS)
    148155            omfree(self._strat.T)
     
    152159            omfree(self._strat.L)
    153160            omfree(self._strat.B)
    154161            omfree(self._strat.fromQ)
    155             id_Delete(&self._strat.Shdl, self._parent._ring)
     162            id_Delete(&self._strat.Shdl, parent._ring)
    156163
    157             if self._parent._ring != currRing:
     164            if parent._ring != currRing:
    158165                oldRing = currRing
    159                 rChangeCurrRing(self._parent._ring)
     166                rChangeCurrRing(parent._ring)
    160167                delete_skStrategy(self._strat)
    161168                rChangeCurrRing(oldRing)
    162169            else:
    163170                delete_skStrategy(self._strat)
     171        Py_XDECREF(self._parent_for_dealloc)
    164172
    165173    def _repr_(self):
    166174        """