Ticket #13714: 13714_idlift_fix.patch

File 13714_idlift_fix.patch, 2.6 KB (added by Bouillaguet, 7 years ago)
  • sage/libs/singular/singular-cdefs.pxi

    # HG changeset patch
    # User Charles Bouillaguet <charles.bouillaguet@lifl.fr>
    # Date 1359634605 -3600
    # Node ID 88933e9138d337e04df9a206061c5867472f3759
    # Parent  ec1fb07db6e23f9fbd4c34f0d48198d08ec76473
    trac 13714 : failing f.lift(I) calls no longer perturb singular internal state
    
    diff --git a/sage/libs/singular/singular-cdefs.pxi b/sage/libs/singular/singular-cdefs.pxi
    a b  
    1414cdef extern from "stdlib.h":
    1515    void delete "delete" (void *ptr)
    1616
     17cdef extern from "factor.h":
     18    cdef int libfac_interruptflag
     19
    1720cdef extern from "factory/factory.h":
    1821
    1922    #
  • sage/rings/polynomial/multi_polynomial_libsingular.pyx

    diff --git a/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/sage/rings/polynomial/multi_polynomial_libsingular.pyx
    a b  
    172172
    173173# singular functions
    174174from sage.libs.singular.decl cimport (
    175     errorreported,
     175    errorreported, libfac_interruptflag,
    176176    p_ISet, rChangeCurrRing, p_Copy, p_Init, p_SetCoeff, p_Setm, p_SetExp, p_Add_q,
    177177    p_NSet, p_GetCoeff, p_Delete, p_GetExp, pNext, rRingVar, omAlloc0, omStrDup,
    178178    omFree, pDivide, p_SetCoeff0, n_Init, p_DivisibleBy, pLcm, p_LmDivisibleBy,
     
    40804080            ValueError: polynomial is not in the ideal
    40814081            sage: f.lift(I)
    40824082            [1, x2]
     4083
     4084        TESTS:
     4085
     4086        Check that :trac:`13714` is fixed::
     4087
     4088            sage: R.<x1,x2> = QQ[]
     4089            sage: I = R.ideal(x2**2 + x1 - 2, x1**2 - 1)
     4090            sage: R.one().lift(I)
     4091            Traceback (most recent call last):
     4092            ...
     4093            ValueError: polynomial is not in the ideal
     4094            sage: foo = I.complete_primary_decomposition() # indirect doctest
     4095            sage: foo[0][0]
     4096            Ideal (x2 - 1, x1 - 1) of Multivariate Polynomial Ring in x1, x2 over Rational Field
     4097
    40834098        """
    4084         global errorreported
     4099        global errorreported, libfac_interruptflag
    40854100        if not self._parent._base.is_field():
    40864101            raise NotImplementedError, "Lifting of multivariate polynomials over non-fields is not implemented."
    40874102
     
    41154130
    41164131        if r!=currRing: rChangeCurrRing(r)  # idLift
    41174132        res = idLift(_I, fI, NULL, 0, 0, 0)
    4118         if errorreported != 0:
     4133        if errorreported != 0 or libfac_interruptflag != 0:
    41194134            errorcode = errorreported
    41204135            errorreported = 0
     4136            libfac_interruptflag = 0
    41214137            if errorcode == 1:
    41224138                raise ValueError("polynomial is not in the ideal")
    41234139            raise RuntimeError