# HG changeset patch
# User Nils Bruin <nbruin@sfu.ca>
# Date 1347727766 25200
# Node ID b1ff7bd7a86709a2271e26789fad63d0187b4f15
# Parent 700061226df5b343889aa4744f2376d351523dc0
#13447: make delete_singular_ring take into account both the ring_refcount_dict refcount and singular's own doomed.ref refcount field. The two should probably be consolidated.
diff git a/sage/libs/singular/ring.pyx b/sage/libs/singular/ring.pyx
a

b

include "../../ext/stdsage.pxi" 
19  19  from sage.libs.gmp.types cimport __mpz_struct 
20  20  from sage.libs.gmp.mpz cimport mpz_init_set_ui, mpz_init_set 
21  21  
22   from sage.libs.singular.decl cimport number, lnumber, napoly, ring, currRing 
 22  from sage.libs.singular.decl cimport number, lnumber, napoly, ring, currRing, currRingHdl 
23  23  from sage.libs.singular.decl cimport rChangeCurrRing, rCopy0, rComplete, rDelete 
24  24  from sage.libs.singular.decl cimport omAlloc0, omStrDup, omAlloc, omAlloc0Bin, sip_sring_bin, rnumber_bin 
25  25  from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_rp, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a 
… 
… 
from sage.rings.polynomial.polynomial_ri 
40  40  
41  41  from sage.misc.misc_c import is_64_bit 
42  42  
 43  import sys 
43  44  
44  45  # mapping str > SINGULAR representation 
45  46  order_dict = { 
… 
… 
cdef void singular_ring_delete(ring *doo 
536  537  
537  538  cdef ring_wrapper_Py r = wrap_ring(doomed) 
538  539  refcount = ring_refcount_dict.pop(r) 
539   if refcount > 1: 
 540  sys.stderr.write('ring delete called with recounts=%d and ref=%d\n'%(refcount,doomed.ref)) 
 541  if refcount > 1 or doomed.ref > 0: 
540  542  ring_refcount_dict[r] = refcount1 
541  543  return 
542  544  