#15671: sig_error() without sig_on()
-------------------------------------+-------------------------------------
       Reporter:  zimmerma           |        Owner:
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.4
      Component:  cython             |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Peter Bruin,       |    Reviewers:
  Jeroen Demeyer                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  84ef4e5fc1bb75cc74ea9147e36efc243dc1a6ab
  u/jdemeyer/ticket/15671            |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by pbruin):

 Replying to [comment:16 jdemeyer]:
 > We should indeed put `sig_on()`/`sig_off()` in many more places, but I'm
 afraid people will worry about the performance impact (there is a very
 small but still measurable slow-down with `sig_on()`).
 Indeed, it seems that at least in the first run we explicitly do not use
 `sig_on()`:
 {{{
 #!python
 cdef ModuleElement _mul_long(self, long n):
     """
     Fast path for multiplying a C long.
     ...
     """
     cdef Integer x = <Integer>PY_NEW(Integer)
     if mpz_size(self.value) > 100000:
         sig_on()
         mpz_mul_si(x.value, self.value, n)
         sig_off()
     else:
         mpz_mul_si(x.value, self.value, n)
     return x
 }}}

 In the second one, `fast_tp_new()` does not check the result of an
 allocation:
 {{{
 #!python

     new = PyObject_MALLOC( sizeof_Integer )
     ...
     memcpy(new, (<void*>global_dummy_Integer), sizeof_Integer )
 }}}
 The signal happens in `memcpy()`; I guess `PyObject_MALLOC()` returned
 `NULL`.

 (Both fragments are from `integer.pyx`.)

--
Ticket URL: <http://trac.sagemath.org/ticket/15671#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to