#11967: os x 10.7 Lion -- Sage segfaults on startup when initializing GiNaC
-----------------------+----------------------------------------------------
   Reporter:  was      |          Owner:  drkirkby  
       Type:  defect   |         Status:  new       
   Priority:  major    |      Milestone:  sage-4.7.3
  Component:  porting  |       Keywords:            
Work_issues:           |       Upstream:  N/A       
   Reviewer:           |         Author:            
     Merged:           |   Dependencies:            
-----------------------+----------------------------------------------------

Comment(by was):

 I looked into this further, but haven't solved the problem.     I made an
 *empty* Cython file a.pyx with Extension description:
 {{{
     Extension('sage.symbolic.a',
               sources = ['sage/symbolic/a.pyx'],
               language = 'c++',
               depends = ginac_depends,
               libraries = ["pynac", "gmp"]),
 }}}

 then I did "sage -ipython" and "import sage.symbolic.a", and I get exactly
 the same crash as when import sage.all.
 I looked at the traceback more carefully.   The line
 {{{
 #0  PyInt_FromLong (ival=Cannot access memory at address 0x0
 ) at intobject.c:91
 }}}
 occurs in the Python library in this code:
 {{{
 #if NSMALLNEGINTS + NSMALLPOSINTS > 0
         if (-NSMALLNEGINTS <= ival && ival < NSMALLPOSINTS) {
                 v = small_ints[ival + NSMALLNEGINTS];
                 Py_INCREF(v);
 <------------------------ ***
 #ifdef COUNT_ALLOCS
 }}}

 Thus the array small_ints -- this is some "object pool" (maybe) -- hasn't
 been initialized.
 This was called from the Pynac library on startup where various constants
 (e.g., 1,2,3,4,5, etc., ) are defined.  In particular, this line in
 pynac's numeric.cpp causes the trouble:
 {{{
     t = PYOBJECT;
     if (!(v._pyobject = PyInt_FromLong(x)))
       py_error("Error creating int");
 }}}

 This *feels* to me a lot like what would happen if two separate copies of
 the Python library were linked in.  One of them hasn't been initialized
 yet, so the object pool is nonsense.    However, I don't see a static
 libpython sitting around anywhere, so I'm not quite sure what happened.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11967#comment:2>
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 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