2011/11/9 Francois Bissey <francois.bis...@canterbury.ac.nz>:
>>
>> rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/devel/co
>
>> oker/x86_64/media/contrib/release/python-gmpy-1.14-1mdv2011.0.x86_64.rpm
>> instalando python-gmpy-1.14-1mdv2011.0.x86_64.rpm a partir de
>> /var/cache/urpmi/rpms
>> Preparando...
>
> Interesting mix of French and Brazilian Portuguese. What happens you try to

  Forgot to add LC_ALL=C to sample command line :-)

> use mpmath on its own (it will use sage in the background) but I am
> wondering
> if it will spit all these glic warnings.

]$ python
Python 2.7.2 (default, Aug 30 2011, 03:39:21)
[GCC 4.6.1 20110826 (Mandriva)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/mpmath/__init__.py", line 6,
in <module>
    from .ctx_mp import MPContext
  File "/usr/lib/python2.7/site-packages/mpmath/ctx_mp.py", line 48, in <module>
    from sage.libs.mpmath.ext_main import Context as BaseMPContext
  File "parent.pxd", line 11, in init sage.libs.mpmath.ext_main
(sage/libs/mpmath/ext_main.c:24996)
  File "element.pxd", line 12, in init sage.structure.parent
(sage/structure/parent.c:21563)
  File "element.pyx", line 184, in init sage.structure.element
(sage/structure/element.c:28577)
  File "/usr/lib64/python2.7/site-packages/sage/misc/sageinspect.py",
line 161, in <module>
    SAGE_ROOT = os.environ["SAGE_ROOT"]
  File "/usr/lib64/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'SAGE_ROOT'
>>>

$ MPMATH_NOSAGE=1 python
Python 2.7.2 (default, Aug 30 2011, 03:39:21)
[GCC 4.6.1 20110826 (Mandriva)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/mpmath/__init__.py", line 6,
in <module>
    from .ctx_mp import MPContext
  File "/usr/lib/python2.7/site-packages/mpmath/ctx_mp.py", line 48, in <module>
    from sage.libs.mpmath.ext_main import Context as BaseMPContext
  File "parent.pxd", line 11, in init sage.libs.mpmath.ext_main
(sage/libs/mpmath/ext_main.c:24996)
  File "element.pxd", line 12, in init sage.structure.parent
(sage/structure/parent.c:21563)
  File "element.pyx", line 184, in init sage.structure.element
(sage/structure/element.c:28577)
  File "/usr/lib64/python2.7/site-packages/sage/misc/sageinspect.py",
line 161, in <module>
    SAGE_ROOT = os.environ["SAGE_ROOT"]
  File "/usr/lib64/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'SAGE_ROOT'
>>>

  But, since gmpy call to mp_set_memory_functions is kind of redundant,
as it just ends up calling malloc/realloc/free anyway, with this patch:

-    mp_set_memory_functions(gmpy_allocate, gmpy_reallocate, gmpy_free);
+    //mp_set_memory_functions(gmpy_allocate, gmpy_reallocate, gmpy_free);

and rebuild/reinstall of python mpmath, it works, e.g. without the
patch:

$ GMPY_DEBUG=99 echo "import mpmath" | sage
----------------------------------------------------------------------
| Sage Version 4.7.2, Release Date: 2011-10-29                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e067e0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002dac530 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002dac550 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002dac570 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e462e0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e46300 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002d472a0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002d472c0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e06da0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e06dc0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e45cd0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002e269c0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x000000000249a3e0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000020d1250 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002148320 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002ad6960 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002c30e80 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002587d90 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000021ceb80 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000028b8570 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000023684d0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002a96ff0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000001df3090 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000022e6b60 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002257770 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002b90820 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002ab5be0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000001ea5eb0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002ba73d0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002025ba0 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x0000000002d94e10 ***
*** glibc detected *** python: realloc(): invalid pointer:
0x00000000023684f0 ***
sage: sage:
Exiting Sage (CPU time 0m0.14s, Wall time 0m0.14s).
*** glibc detected *** python: free(): invalid pointer: 0x0000000002e067c0 ***
*** glibc detected *** python: free(): invalid pointer: 0x0000000002e067a0 ***

and with the patch:

$ GMPY_DEBUG=99 echo "import mpmath" | sage
----------------------------------------------------------------------
| Sage Version 4.7.2, Release Date: 2011-10-29                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: sage:
Exiting Sage (CPU time 0m0.14s, Wall time 0m0.14s).

  Everybody willing to call mp_set_memory_functions is a recipe
for problems...

> Francois

Paulo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to