#4935: is_perfect_power leaks
----------------------+-----------------------------------------------------
 Reporter:  mabshoff  |        Owner:  robertwb
     Type:  defect    |       Status:  new     
 Priority:  major     |    Milestone:  sage-3.3
Component:  memleak   |   Resolution:          
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by robertwb):

 :)

 The Cython code looks plenty clean though.

 {{{
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) :
 (Py_INCREF(Py_False), Py_False))

 ...

 static PyObject
 *__pyx_pf_4sage_5rings_7integer_7Integer_is_perfect_power(PyObject
 *__pyx_v_self, PyObject *unused) {
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;

   /* "/Users/robert/sage/sage-3.1.3/devel/sage-
 main/sage/rings/integer.pyx":3002
  *             False
  *         """
  *         return mpz_perfect_power_p(self.value)             #
 <<<<<<<<<<<<<<
  *
  *     def jacobi(self, b):
  */
   __pyx_1 = __Pyx_PyBool_FromLong(mpz_perfect_power_p(((struct
 __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_v_self)->value)); if
 (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002;
 __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;

   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   Py_XDECREF(__pyx_1);
   __Pyx_AddTraceback("sage.rings.integer.Integer.is_perfect_power");
   __pyx_r = NULL;
   __pyx_L0:;
   return __pyx_r;
 }

 }}}

 (Note that much of that gets optimized away at compile time, for example
 the error branch is never taken).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4935#comment:3>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to