Bug#906796: sagemath: Sage crashes at startup (segfault in pari modules)

Giovanni Mascellani gio at debian.org
Tue Aug 21 08:00:45 BST 2018


Package: sagemath
Version: 8.2-5
Severity: important

Dear Maintainer,

when I start sage, it immediately crashes with the attached crash
report. Before running sage I removed the directories .ipython, .sage
and .local/lib/python* (which I discovered contained some Python modules
that were executed by sage upon startup).

The end of the crash report seems to mention a segmentation fault in
some pari module, but I am not able to extract more information from it.

Thanks, Giovanni.


-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.17.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=it_IT.utf8, LC_CTYPE=it_IT.utf8 (charmap=UTF-8), LANGUAGE=it_IT.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages sagemath depends on:
ii  cysignals-tools                              1.6.7+ds-4
ii  cython                                       0.28.4-1
ii  ecl                                          16.1.2-4+b1
ii  eclib-tools                                  20171002-1+b3
ii  f2c                                          20160102-1
ii  fflas-ffpack                                 2.3.2-2
ii  flintqs                                      1:1.0-3
ii  gap-core                                     4r8p8-3
ii  gfan                                         0.5+dfsg-6
ii  gmp-ecm                                      7.0.4+ds-3
ii  ipython                                      5.5.0-1
ii  iso-codes                                    3.79-1
ii  jmol                                         14.6.4+2016.11.05+dfsg1-3.1
ii  lcalc                                        1.23+dfsg-7
ii  less                                         487-0.1+b1
ii  libatlas3-base [liblapack.so.3]              3.10.3-7+b1
ii  libblas3 [libblas.so.3]                      3.8.0-1+b1
ii  libbrial-groebner3                           1.2.0-2
ii  libbrial3                                    1.2.0-2
ii  libc6                                        2.27-5
ii  libcdd-tools                                 094h-1+b1
ii  libcliquer1                                  1.21-2
ii  libec3                                       20171002-1+b3
ii  libecm1                                      7.0.4+ds-3
ii  libflint-2.5.2                               2.5.2-18
ii  libflint-arb2                                1:2.12.0-3
ii  libgap-sage-4                                4.8.8+3+20160327g69a66f0+dsx-1
ii  libgcc1                                      1:8.2.0-4
ii  libgd3                                       2.2.5-4
ii  libgivaro9                                   4.0.4-2
ii  libglpk40                                    4.65-2
ii  libgmp10                                     2:6.1.2+dfsg-3
ii  libgmpxx4ldbl                                2:6.1.2+dfsg-3
ii  libgsl23                                     2.5+dfsg-4
ii  libgslcblas0                                 2.5+dfsg-4
ii  libiml0                                      1.0.4-1+b2
ii  libjs-mathjax                                2.7.4+dfsg-1
ii  libjs-three                                  80+dfsg2-2
ii  liblapack3 [liblapack.so.3]                  3.8.0-1+b1
ii  liblfunction0                                1.23+dfsg-7
ii  liblinbox-1.5.2-0                            1.5.2-2
ii  liblinboxsage-1.5.2-0                        1.5.2-2
ii  liblrcalc1                                   1.2-2+b1
ii  libm4ri-0.0.20140914                         20140914-2+b1
ii  libm4rie-0.0.20150908                        20150908-2
ii  libmpc3                                      1.1.0-1
ii  libmpfi0                                     1.5.3+ds-2
ii  libmpfr6                                     4.0.1-1
ii  libntl35                                     10.5.0-2
ii  libopenblas-base [liblapack.so.3]            0.3.2+ds-1
ii  libpari-gmp-tls5                             2.9.5-1
ii  libplanarity0                                3.0.0.5-3
ii  libpng16-16                                  1.6.34-2
ii  libppl14                                     1:1.2-3
ii  libpynac17                                   0.7.19-2
ii  libratpoints-2.1.3                           1:2.1.3-1+b2
ii  libreadline7                                 7.0-5
ii  librw0                                       0.8+ds-1
ii  libsingular4                                 1:4.1.0-p3+ds-2+b3
ii  libstdc++6                                   8.2.0-4
ii  libsymmetrica2                               2.0+ds-5
ii  libzn-poly-0.9                               0.9-3+b2
ii  maxima-sage                                  5.39.0+ds-3
ii  maxima-sage-doc                              5.39.0+ds-3
ii  maxima-sage-share                            5.39.0+ds-3
ii  nauty                                        2.6r10+ds-1
ii  octave                                       4.4.1~rc2-3
ii  palp                                         2.1-5
ii  pari-doc                                     2.11.0-1
ii  pari-galdata                                 0.20080411-2
ii  pari-gp                                      2.11.0-1
ii  pari-seadata                                 0.20090618-1
ii  python                                       2.7.15-3
ii  python-alabaster                             0.7.8-1
ii  python-babel                                 2.4.0+dfsg.1-2
ii  python-backports-abc                         0.5-2
ii  python-backports-shutil-get-terminal-size    1.0.0-5
ii  python-backports.functools-lru-cache         1.5-1
ii  python-backports.ssl-match-hostname          3.5.0.1-1
ii  python-brial                                 1.2.0-2
ii  python-configparser                          3.5.0b2-1
ii  python-crypto                                2.6.1-9+b1
ii  python-cvxopt                                1.1.9+dfsg-3+b1
ii  python-cycler                                0.10.0-1
ii  python-cypari2                               1.2.1-1
ii  python-cysignals-pari                        1.6.7+ds-4
ii  python-decorator                             4.3.0-1
ii  python-docutils                              0.14+dfsg-3
ii  python-enum34                                1.1.6-2
ii  python-flask                                 1.0.2-1
ii  python-flask-autoindex                       0.6.1-1
ii  python-flask-babel                           0.11.2-2
ii  python-flask-oldsessions                     0.10+git20121007-2
ii  python-flask-openid                          1.2.5+dfsg-2
ii  python-flask-silk                            0.2-13
ii  python-fpylll                                0.3.0+ds-3+b1
ii  python-functools32                           3.2.3.2-3
ii  python-future                                0.15.2-4
ii  python-gd                                    0.59-1
ii  python-gnutls                                3.0.0-1
ii  python-imagesize                             1.0.0-1
ii  python-ipython-genutils                      0.2.0-1
ii  python-itsdangerous                          0.24+dfsg1-2
ii  python-jsonschema                            2.6.0-2
ii  python-matplotlib                            2.2.2-4+b1
ii  python-mistune                               0.8.3-2
ii  python-moinmoin                              1.9.9-1
ii  python-mpmath                                1.0.0-1
ii  python-networkx                              2.1-1
ii  python-numpy [python-numpy-abi9]             1:1.14.5-1+b1
ii  python-openid                                2.2.5-6
ii  python-path                                  11.0.1-2
ii  python-pathlib2                              2.3.2-1
ii  python-pexpect                               4.6.0-1
ii  python-pickleshare                           0.7.4-4
ii  python-pil                                   5.2.0-2
ii  python-pip                                   9.0.1-2.3
ii  python-pkgconfig                             1.3.1-1
ii  python-ply                                   3.11-3
ii  python-prompt-toolkit                        1.0.15-1
ii  python-psutil                                5.4.6-1+b1
ii  python-ptyprocess                            0.6.0-1
ii  python-pygments                              2.2.0+dfsg-1
ii  python-rpy2                                  2.8.6-2+b1
ii  python-sagenb                                1.0.1+ds1-5
ii  python-sagenb-export                         3.2-3
ii  python-scipy                                 1.1.0-1+b1
ii  python-setuptools                            39.2.0-1
ii  python-setuptools-scm                        3.0.6-1
ii  python-simplegeneric                         0.8.1-2
ii  python-singledispatch                        3.4.0.3-2
ii  python-snowballstemmer                       1.2.1-1
ii  python-sphinx                                1.7.6-1
ii  python-subprocess32                          3.5.2-1
ii  python-sympy                                 1.2-1
ii  python-terminado                             0.8.1-3
ii  python-tk                                    2.7.15-1
ii  python-tornado                               5.0.2-1+b1
ii  python-traitlets                             4.3.2-1
ii  python-twisted                               18.7.0-2
ii  python-typing                                3.6.4-1
ii  python-tz                                    2018.5-1
ii  python-vcversioner                           2.16.0.0-1
ii  python-wcwidth                               0.1.7+dfsg1-2
ii  python-werkzeug                              0.14.1+dfsg1-1
ii  python-zmq                                   17.1.0-1
ii  python-zope.interface                        4.3.2-1+b2
ii  python2.7                                    2.7.15-3
ii  python3                                      3.6.6-1
ii  r-base-core                                  3.5.1-1+b1
ii  r-cran-lattice                               0.20-35-1+b2
ii  rubiks                                       20070912-3
ii  sagemath-common                              8.2-5
ii  sagemath-database-conway-polynomials         0.5-4
ii  sagemath-database-elliptic-curves            0.8-2
ii  sagemath-database-graphs                     20161026+dfsg-2
ii  sagemath-database-mutually-combinatorial-de  20140630-3
ii  sagemath-database-polytopes                  20170220-2
ii  singular                                     1:4.1.0-p3+ds-2+b3
ii  singular-doc                                 1:4.1.0-p3+ds-2
ii  sqlite3                                      3.24.0-1
ii  sympow                                       2.023.3-1
ii  tachyon                                      0.99~b6+dsx-8
ii  xcas                                         1.2.3.57+dfsg1-2+b5
ii  zlib1g                                       1:1.2.11.dfsg-1

Versions of packages sagemath recommends:
ii  sagemath-doc-en     8.2-5
ii  sagemath-jupyter    8.2-5
ii  sagetex             3.0+ds-6
ii  texlive-latex-base  2018.20180725-1

Versions of packages sagemath suggests:
pn  dot2tex      <none>
pn  gap-design   <none>
pn  gap-factint  <none>
pn  gap-grape    <none>
pn  gap-guava    <none>
pn  gap-laguna   <none>
pn  gap-sonata   <none>
pn  gap-toric    <none>

-- no debconf information
-------------- next part --------------
***************************************************************************

IPython post-mortem report

{'commit_hash': u'b467d487e',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/lib/python2.7/dist-packages/IPython',
 'ipython_version': '5.5.0',
 'os_name': 'posix',
 'platform': 'Linux-4.17.0-1-amd64-x86_64-with-debian-buster-sid',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.15 (default, Jul 28 2018, 11:29:29) \n[GCC 8.1.0]'}

***************************************************************************



***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
SignalError                                  Python 2.7.15: /usr/bin/python
                                                   Tue Aug 21 08:54:13 2018
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/usr/share/sagemath/bin/sage-ipython in <module>()
      1 #!/usr/bin/env python
      2 # -*- coding: utf-8 -*-
      3 """
      4 Sage IPython startup script.
      5 """
      6 
      7 # Display startup banner. Do this before anything else to give the user
      8 # early feedback that Sage is starting.
      9 from sage.misc.banner import banner
     10 banner()
     11 
     12 from sage.repl.interpreter import SageTerminalApp
     13 
     14 app = SageTerminalApp.instance()
---> 15 app.initialize()
        global app.initialize = <bound method SageTerminalApp.initialize of <sage.repl.interpreter.SageTerminalApp object at 0x7fc8152821d0>>
     16 app.start()

<decorator-gen-110> in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)

/usr/lib/python2.7/dist-packages/traitlets/config/application.pyc in catch_config_error(method=<function initialize>, app=<sage.repl.interpreter.SageTerminalApp object>, *args=(None,), **kwargs={})
     72     TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR = False
     73 else:
     74     raise ValueError("Unsupported value for environment variable: 'TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR' is set to '%s' which is none of  {'0', '1', 'false', 'true', ''}."% _envvar )
     75 
     76 
     77 @decorator
     78 def catch_config_error(method, app, *args, **kwargs):
     79     """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
     80 
     81     On a TraitError (generally caused by bad config), this will print the trait's
     82     message, and exit the app.
     83 
     84     For use on init methods, to prevent invoking excepthook on invalid input.
     85     """
     86     try:
---> 87         return method(app, *args, **kwargs)
        method = <function initialize at 0x7fc8135bd398>
        app = <sage.repl.interpreter.SageTerminalApp object at 0x7fc8152821d0>
        args = (None,)
        kwargs = {}
     88     except (TraitError, ArgumentError) as e:
     89         app.print_help()
     90         app.log.fatal("Bad config encountered during initialization:")
     91         app.log.fatal(str(e))
     92         app.log.debug("Config at the time: %s", app.config)
     93         app.exit(1)
     94 
     95 
     96 class ApplicationError(Exception):
     97     pass
     98 
     99 
    100 class LevelFormatter(logging.Formatter):
    101     """Formatter with additional `highlevel` record
    102 

/usr/lib/python2.7/dist-packages/IPython/terminal/ipapp.pyc in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
    301 
    302         return super(TerminalIPythonApp, self).parse_command_line(argv)
    303     
    304     @catch_config_error
    305     def initialize(self, argv=None):
    306         """Do actions after construct, but before starting the app."""
    307         super(TerminalIPythonApp, self).initialize(argv)
    308         if self.subapp is not None:
    309             # don't bother initializing further, starting subapp
    310             return
    311         # print self.extra_args
    312         if self.extra_args and not self.something_to_run:
    313             self.file_to_run = self.extra_args[0]
    314         self.init_path()
    315         # create the shell
--> 316         self.init_shell()
        self.init_shell = <bound method SageTerminalApp.init_shell of <sage.repl.interpreter.SageTerminalApp object at 0x7fc8152821d0>>
    317         # and draw the banner
    318         self.init_banner()
    319         # Now a variety of things that happen after the banner is printed.
    320         self.init_gui_pylab()
    321         self.init_extensions()
    322         self.init_code()
    323 
    324     def init_shell(self):
    325         """initialize the InteractiveShell instance"""
    326         # Create an InteractiveShell instance.
    327         # shell.display_banner should always be False for the terminal
    328         # based app, because we call shell.show_banner() by hand below
    329         # so the banner shows *before* all extension loading stuff.
    330         self.shell = self.interactive_shell_class.instance(parent=self,
    331                         profile_dir=self.profile_dir,

/usr/lib/python2.7/dist-packages/sage/repl/interpreter.pyc in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
    747         self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions
    748 
    749         # Load the %lprun extension if available
    750         try:
    751             import line_profiler
    752         except ImportError:
    753             pass
    754         else:
    755             self.extensions.append('line_profiler')
    756 
    757         if self.shell.has_sage_extensions:
    758             self.extensions.remove(SAGE_EXTENSION)
    759 
    760             # load sage extension here to get a crash if
    761             # something is wrong with the sage library
--> 762             self.shell.extension_manager.load_extension(SAGE_EXTENSION)
        self.shell.extension_manager.load_extension = <bound method ExtensionManager.load_extension of <IPython.core.extensions.ExtensionManager object at 0x7fc814900810>>
        global SAGE_EXTENSION = 'sage'
    763 
    764 

/usr/lib/python2.7/dist-packages/IPython/core/extensions.pyc in load_extension(self=<IPython.core.extensions.ExtensionManager object>, module_str='sage')
     70 
     71         Returns the string "already loaded" if the extension is already loaded,
     72         "no load function" if the module doesn't have a load_ipython_extension
     73         function, or None if it succeeded.
     74         """
     75         if module_str in self.loaded:
     76             return "already loaded"
     77         
     78         from IPython.utils.syspathcontext import prepended_to_syspath
     79         
     80         with self.shell.builtin_trap:
     81             if module_str not in sys.modules:
     82                 with prepended_to_syspath(self.ipython_extension_dir):
     83                     __import__(module_str)
     84             mod = sys.modules[module_str]
---> 85             if self._call_load_ipython_extension(mod):
        self._call_load_ipython_extension = <bound method ExtensionManager._call_load_ipython_extension of <IPython.core.extensions.ExtensionManager object at 0x7fc814900810>>
        mod = <module 'sage' from '/usr/lib/python2.7/dist-packages/sage/__init__.pyc'>
     86                 self.loaded.add(module_str)
     87             else:
     88                 return "no load function"
     89 
     90     def unload_extension(self, module_str):
     91         """Unload an IPython extension by its module name.
     92 
     93         This function looks up the extension's name in ``sys.modules`` and
     94         simply calls ``mod.unload_ipython_extension(self)``.
     95         
     96         Returns the string "no unload function" if the extension doesn't define
     97         a function to unload itself, "not loaded" if the extension isn't loaded,
     98         otherwise None.
     99         """
    100         if module_str not in self.loaded:

/usr/lib/python2.7/dist-packages/IPython/core/extensions.pyc in _call_load_ipython_extension(self=<IPython.core.extensions.ExtensionManager object>, mod=<module 'sage' from '/usr/lib/python2.7/dist-packages/sage/__init__.pyc'>)
    117         """
    118         from IPython.utils.syspathcontext import prepended_to_syspath
    119 
    120         if (module_str in self.loaded) and (module_str in sys.modules):
    121             self.unload_extension(module_str)
    122             mod = sys.modules[module_str]
    123             with prepended_to_syspath(self.ipython_extension_dir):
    124                 reload(mod)
    125             if self._call_load_ipython_extension(mod):
    126                 self.loaded.add(module_str)
    127         else:
    128             self.load_extension(module_str)
    129 
    130     def _call_load_ipython_extension(self, mod):
    131         if hasattr(mod, 'load_ipython_extension'):
--> 132             mod.load_ipython_extension(self.shell)
        mod.load_ipython_extension = <function load_ipython_extension at 0x7fc8154dd668>
        self.shell = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fc81355edd0>
    133             return True
    134 
    135     def _call_unload_ipython_extension(self, mod):
    136         if hasattr(mod, 'unload_ipython_extension'):
    137             mod.unload_ipython_extension(self.shell)
    138             return True
    139 
    140     def install_extension(self, url, filename=None):
    141         """Download and install an IPython extension. 
    142 
    143         If filename is given, the file will be so named (inside the extension
    144         directory). Otherwise, the name from the URL will be used. The file must
    145         have a .py or .zip extension; otherwise, a ValueError will be raised.
    146 
    147         Returns the full path to the installed file.

/usr/lib/python2.7/dist-packages/sage/__init__.pyc in load_ipython_extension(*args=(<sage.repl.interpreter.SageTerminalInteractiveShell object>,))
      1 __all__ = ['all']
      2 
      3 # Make sure that the correct zlib library is loaded. This is needed
      4 # to prevent the system zlib to be loaded instead of the Sage one.
      5 # See https://trac.sagemath.org/ticket/23122
      6 import zlib
      7 
      8 # IPython calls this when starting up
      9 def load_ipython_extension(*args):
     10     import sage.repl.ipython_extension
---> 11     sage.repl.ipython_extension.load_ipython_extension(*args)
        sage.repl.ipython_extension.load_ipython_extension = <function load_ipython_extension at 0x7fc8121d8de8>
        args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fc81355edd0>,)
     12 
     13 
     14 # Monkey-patch inspect.isfunction() to support Cython functions.
     15 def isfunction(obj):
     16     """
     17     Check whether something is a function.
     18 
     19     We assume that anything which has a genuine ``__code__``
     20     attribute (not using ``__getattr__`` overrides) is a function.
     21     This is meant to support Cython functions.
     22 
     23     EXAMPLES::
     24 
     25         sage: from inspect import isfunction
     26         sage: def f(): pass
     27         sage: isfunction(f)
     28         True
     29         sage: isfunction(lambda x:x)
     30         True
     31         sage: from sage.categories.coercion_methods import _mul_parent

/usr/lib/python2.7/dist-packages/sage/repl/ipython_extension.pyc in wrapper(*args=(<sage.repl.interpreter.SageTerminalInteractiveShell object>,), **kwargs={})
    546         ....:     if work:
    547         ....:         return 'foo worked'
    548         ....:     raise RuntimeError("foo didn't work")
    549         sage: foo(False)
    550         Traceback (most recent call last):
    551         ...
    552         RuntimeError: foo didn't work
    553         sage: foo(True)
    554         'foo worked'
    555         sage: foo(False)
    556         sage: foo(True)
    557     """
    558     @wraps(func)
    559     def wrapper(*args, **kwargs):
    560         if not wrapper.has_run:
--> 561             result = func(*args, **kwargs)
        result = undefined
        global func = undefined
        args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fc81355edd0>,)
        kwargs = {}
    562             wrapper.has_run = True
    563             return result
    564     wrapper.has_run = False
    565     return wrapper
    566 
    567 
    568 @run_once
    569 def load_ipython_extension(ip):
    570     """
    571     Load the extension in IPython.
    572     """
    573     # this modifies ip
    574     SageCustomizations(shell=ip)

/usr/lib/python2.7/dist-packages/sage/repl/ipython_extension.pyc in load_ipython_extension(ip=<sage.repl.interpreter.SageTerminalInteractiveShell object>)
    559     def wrapper(*args, **kwargs):
    560         if not wrapper.has_run:
    561             result = func(*args, **kwargs)
    562             wrapper.has_run = True
    563             return result
    564     wrapper.has_run = False
    565     return wrapper
    566 
    567 
    568 @run_once
    569 def load_ipython_extension(ip):
    570     """
    571     Load the extension in IPython.
    572     """
    573     # this modifies ip
--> 574     SageCustomizations(shell=ip)
        global SageCustomizations = <class 'sage.repl.ipython_extension.SageCustomizations'>
        global shell = undefined
        ip = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fc81355edd0>

/usr/lib/python2.7/dist-packages/sage/repl/ipython_extension.pyc in __init__(self=<sage.repl.ipython_extension.SageCustomizations object>, shell=<sage.repl.interpreter.SageTerminalInteractiveShell object>)
    417     def __init__(self, shell=None):
    418         """
    419         Initialize the Sage plugin.
    420         """
    421         self.shell = shell
    422 
    423         self.auto_magics = SageMagics(shell)
    424         self.shell.register_magics(self.auto_magics)
    425 
    426         import sage.misc.edit_module as edit_module
    427         self.shell.set_hook('editor', edit_module.edit_devel)
    428 
    429         self.init_inspector()
    430         self.init_line_transforms()
    431 
--> 432         import sage.all # until sage's import hell is fixed
        sage.all = undefined
    433 
    434         self.shell.verbose_quit = True
    435         self.set_quit_hook()
    436 
    437         self.register_interface_magics()
    438 
    439         if SAGE_IMPORTALL == 'yes':
    440             self.init_environment()
    441 
    442     def register_interface_magics(self):
    443         """
    444         Register magics for each of the Sage interfaces
    445         """
    446         from sage.repl.interface_magic import InterfaceMagic
    447         InterfaceMagic.register_all(self.shell)

/usr/lib/python2.7/dist-packages/sage/all.py in <module>()
     83 from sage.misc.all       import *         # takes a while
     84 from sage.typeset.all    import *
     85 from sage.repl.all       import *
     86 
     87 from sage.misc.sh import sh
     88 
     89 from sage.libs.all       import *
     90 from sage.data_structures.all import *
     91 from sage.doctest.all    import *
     92 
     93 from sage.structure.all  import *
     94 from sage.rings.all      import *
     95 from sage.arith.all      import *
     96 from sage.matrix.all     import *
     97 
---> 98 from sage.symbolic.all   import *
        global sage.symbolic.all = undefined
     99 from sage.modules.all    import *
    100 from sage.monoids.all    import *
    101 from sage.algebras.all   import *
    102 from sage.modular.all    import *
    103 from sage.sat.all        import *
    104 from sage.schemes.all    import *
    105 from sage.graphs.all     import *
    106 from sage.groups.all     import *
    107 from sage.arith.power    import generic_power as power
    108 from sage.databases.all  import *
    109 from sage.categories.all import *
    110 from sage.sets.all       import *
    111 from sage.probability.all import *
    112 from sage.interfaces.all import *
    113 

/usr/lib/python2.7/dist-packages/sage/symbolic/all.py in <module>()
      1 from __future__ import absolute_import
      2 
----> 3 from sage.libs.pynac.pynac import I
        global sage.libs.pynac.pynac = undefined
        global I = undefined
      4 i = I
      5 
      6 from .ring import SR
      7 from .constants import (pi, e, NaN, golden_ratio, log2, euler_gamma, catalan,
      8                        khinchin, twinprime, mertens, glaisher)
      9 from .expression import Expression, solve_diophantine, hold
     10 from .callable import CallableSymbolicExpressionRing
     11 
     12 from sage.symbolic.relation import solve, solve_mod, solve_ineq
     13 from sage.symbolic.assumptions import assume, forget, assumptions, assuming
     14 
     15 from .units import units

/usr/lib/python2.7/dist-packages/sage/libs/pynac/pynac.pyx in init sage.libs.pynac.pynac()
   2516     py_funcs.ex_to_pyExpression = &ex_to_pyExpression
   2517     py_funcs.subs_args_to_PyTuple = &subs_args_to_PyTuple
   2518     py_funcs.py_print_function = &py_print_function
   2519     py_funcs.py_latex_function = &py_latex_function
   2520     py_funcs.py_get_ginac_serial = &py_get_ginac_serial
   2521     py_funcs.py_get_sfunction_from_serial = &py_get_sfunction_from_serial
   2522     py_funcs.py_get_serial_from_sfunction = &py_get_serial_from_sfunction
   2523     py_funcs.py_get_serial_for_new_sfunction = &py_get_serial_for_new_sfunction
   2524 
   2525     py_funcs.py_get_constant = &py_get_constant
   2526     py_funcs.py_print_fderivative =  &py_print_fderivative
   2527     py_funcs.py_latex_fderivative =  &py_latex_fderivative
   2528     py_funcs.paramset_to_PyTuple = &paramset_to_PyTuple
   2529 
   2530 init_function_table()
-> 2531 init_pynac_I()
        global init_pynac_I = <built-in function init_pynac_I>
   2532 
   2533 set_ginac_fn_serial()

/usr/lib/python2.7/dist-packages/sage/libs/pynac/pynac.pyx in sage.libs.pynac.pynac.init_pynac_I (build/cythonized/sage/libs/pynac/pynac.cpp:28036)()
   2418         <type 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'>
   2419 
   2420     Check that :trac:`10064` is fixed::
   2421 
   2422         sage: y = I*I*x / x # so y is the expression -1
   2423         sage: y.is_positive()
   2424         False
   2425         sage: z = -x / x
   2426         sage: z.is_positive()
   2427         False
   2428         sage: bool(z == y)
   2429         True
   2430     """
   2431     global pynac_I, I
   2432     from sage.rings.number_field.number_field import QuadraticField
-> 2433     K = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')
        global K = undefined
        global QuadraticField = undefined
        global embedding = undefined
        global CC.gen = <bound method ComplexField_class_with_category.gen of Complex Field with 53 bits of precision>
        global latex_name = undefined
   2434     pynac_I = K.gen()
   2435     ginac_pyinit_I(pynac_I)
   2436     I = new_Expression_from_GEx(ring.SR, g_I)
   2437 
   2438 
   2439 def init_function_table():
   2440     """
   2441     Initializes the function pointer table in Pynac.  This must be
   2442     called before Pynac is used; otherwise, there will be segfaults.
   2443     """
   2444 
   2445     py_funcs.py_gcd = &py_gcd
   2446     py_funcs.py_lcm = &py_lcm
   2447     py_funcs.py_real = &py_real
   2448     py_funcs.py_imag = &py_imag

/usr/lib/python2.7/dist-packages/sage/rings/number_field/number_field.pyc in QuadraticField(D=-1, name='I', check=True, embedding=1.00000000000000*I, latex_name='i', **args={})
    928         False
    929     """
    930     D = QQ(D)
    931     if check:
    932         if D.is_square():
    933             raise ValueError("D must not be a perfect square.")
    934     R = QQ['x']
    935     f = R([-D, 0, 1])
    936     if embedding is True:
    937         if D > 0:
    938             embedding = RLF(D).sqrt()
    939         else:
    940             embedding = CLF(D).sqrt()
    941     if latex_name == 'sqrt':
    942         latex_name = r'\sqrt{%s}' % D
--> 943     return NumberField(f, name, check=False, embedding=embedding, latex_name=latex_name, **args)
        global NumberField = <function NumberField at 0x7fc602d8c050>
        f = x^2 + 1
        name = 'I'
        check = True
        global False = undefined
        embedding = 1.00000000000000*I
        latex_name = 'i'
        args = {}
    944 
    945 def is_AbsoluteNumberField(x):
    946     """
    947     Return True if x is an absolute number field.
    948 
    949     EXAMPLES::
    950 
    951         sage: from sage.rings.number_field.number_field import is_AbsoluteNumberField
    952         sage: is_AbsoluteNumberField(NumberField(x^2+1,'a'))
    953         True
    954         sage: is_AbsoluteNumberField(NumberField([x^3 + 17, x^2+1],'a'))
    955         False
    956 
    957     The rationals are a number field, but they're not of the absolute
    958     number field class.

/usr/lib/python2.7/dist-packages/sage/rings/number_field/number_field.pyc in NumberField(polynomial=x^2 + 1, name='I', check=False, names=None, embedding=1.00000000000000*I, latex_name='i', assume_disc_small=False, maximize_at_primes=None, structure=None)
    530         sage: K = NumberField(t^4 - 2, 'a')
    531         sage: K.hom([K.gen().matrix()])
    532         Ring morphism:
    533           From: Number Field in a with defining polynomial x^4 - 2
    534           To:   Full MatrixSpace of 4 by 4 dense matrices over Rational Field
    535           Defn: a |--> [0 1 0 0]
    536                        [0 0 1 0]
    537                        [0 0 0 1]
    538                        [2 0 0 0]
    539     """
    540     if names is not None:
    541         name = names
    542     if isinstance(polynomial, (list,tuple)):
    543         return NumberFieldTower(polynomial, names=name, check=check, embeddings=embedding, latex_names=latex_name, assume_disc_small=assume_disc_small, maximize_at_primes=maximize_at_primes, structures=structure)
    544 
--> 545     return NumberField_version2(polynomial=polynomial, name=name, check=check, embedding=embedding, latex_name=latex_name, assume_disc_small=assume_disc_small, maximize_at_primes=maximize_at_primes, structure=structure)
        global NumberField_version2 = <sage.rings.number_field.number_field.NumberFieldFactory object at 0x7fc602d7bc00>
        polynomial = x^2 + 1
        name = 'I'
        check = False
        embedding = 1.00000000000000*I
        latex_name = 'i'
        assume_disc_small = False
        maximize_at_primes = None
        structure = None
    546 
    547 class NumberFieldFactory(UniqueFactory):
    548     r"""
    549     Factory for number fields.
    550 
    551     This should usually not be called directly, use :meth:`NumberField`
    552     instead.
    553 
    554     INPUT:
    555 
    556         - ``polynomial`` - a polynomial over `\QQ` or a number field.
    557         - ``name`` - a string (default: ``'a'``), the name of the generator
    558         - ``check`` - a boolean (default: ``True``); do type checking and
    559           irreducibility checking.
    560         - ``embedding`` - ``None`` or an element, the images of the generator

/usr/lib/python2.7/dist-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:2016)()
    353         It already created one, so don't re-create::
    354 
    355             sage: test_factory(1,2,3)
    356             <sage.structure.test_factory.A instance at ...>
    357             sage: test_factory(1,2,3) is test_factory(1,2,3)
    358             True
    359 
    360         Of course, with a different key, a new object will be created::
    361 
    362             sage: test_factory(1,2,3) is test_factory(1,2,4)
    363             Making object (1, 2, 4)
    364             False
    365         """
    366         key, kwds = self.create_key_and_extra_args(*args, **kwds)
    367         version = self.get_version(sage_version)
--> 368         return self.get_object(version, key, kwds)
        global self.get_object = undefined
        global version = undefined
        global key = undefined
        global kwds = undefined
    369 
    370     cpdef get_object(self, version, key, extra_args):
    371         """
    372         Returns the object corresponding to ``key``, creating it with
    373         ``extra_args`` if necessary (for example, it isn't in the cache
    374         or it is unpickling from an older version of Sage).
    375 
    376         EXAMPLES::
    377 
    378             sage: from sage.structure.test_factory import test_factory
    379             sage: a = test_factory.get_object(3.0, 'a', {}); a
    380             Making object a
    381             <sage.structure.test_factory.A instance at ...>
    382             sage: test_factory.get_object(3.0, 'a', {}) is test_factory.get_object(3.0, 'a', {})
    383             True

/usr/lib/python2.7/dist-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.get_object (build/cythonized/sage/structure/factory.c:2205)()
    390 
    391         TESTS:
    392 
    393         Check that :trac:`16317` has been fixed, i.e., caching works for
    394         unhashable objects::
    395 
    396             sage: K.<u> = Qq(4)
    397             sage: test_factory.get_object(3.0, (K(1), 'c'), {})  is test_factory.get_object(3.0, (K(1), 'c'), {})
    398             Making object (1 + O(2^20), 'c')
    399             True
    400 
    401         """
    402         cache_key = key
    403         try:
    404             try:
--> 405                 return self._cache[version, cache_key]
        global self._cache = undefined
        global version = undefined
        global cache_key = undefined
    406             except TypeError: # key is unhashable
    407                 cache_key = _cache_key(cache_key)
    408                 return self._cache[version, cache_key]
    409         except KeyError:
    410             pass
    411         obj = self.create_object(version, key, **extra_args)
    412         self._cache[version, cache_key] = obj
    413         try:
    414             for key in self.other_keys(key, obj):
    415                 try:
    416                     self._cache[version, key] = obj
    417                 except TypeError: # key is unhashable
    418                     self._cache[version, _cache_key(key)] = obj
    419             obj._factory_data = self, version, key, extra_args
    420 

/usr/lib/python2.7/dist-packages/sage/misc/weak_dict.pyx in sage.misc.weak_dict.WeakValueDictionary.__getitem__ (build/cythonized/sage/misc/weak_dict.c:3654)()
    679 
    680             sage: D[10] = ZZ
    681             sage: D[int(10)]
    682             Integer Ring
    683 
    684         Check that :trac:`15956` has been fixed, i.e., a ``TypeError`` is
    685         raised for unhashable objects::
    686 
    687             sage: D = sage.misc.weak_dict.WeakValueDictionary()
    688             sage: D[matrix([])]
    689             Traceback (most recent call last):
    690             ...
    691             TypeError: mutable matrices are unhashable
    692 
    693         """
--> 694         cdef PyObject* wr = PyDict_GetItemWithError(self, k)
        global cdef = undefined
        global PyObject = undefined
        global wr = undefined
        global PyDict_GetItemWithError = undefined
        global self = undefined
        global k = undefined
    695         if wr == NULL:
    696             raise KeyError(k)
    697         out = PyWeakref_GetObject(wr)
    698         if out == Py_None:
    699             raise KeyError(k)
    700         return <object>out
    701 
    702     def __contains__(self, k):
    703         """
    704         Containment in the set of keys.
    705 
    706         TESTS::
    707 
    708             sage: import sage.misc.weak_dict
    709             sage: class Vals(object): pass

/usr/lib/python2.7/dist-packages/sage/cpython/dict_del_by_value.pyx in sage.cpython.dict_del_by_value.PyDict_GetItemWithError (build/cythonized/sage/cpython/dict_del_by_value.c:1200)()
     43             Py_ssize_t ma_mask
     44             PyDictEntry* ma_table
     45             PyDictEntry* (*ma_lookup)(PyDictObject *mp, PyObject *key, Py_hash_t hash) except NULL
     46 
     47         PyObject* Py_None
     48         #we need this redefinition because we want to be able to call
     49         #PyWeakref_GetObject with borrowed references. This is the recommended
     50         #strategy according to Cython/Includes/cpython/__init__.pxd
     51         PyObject* PyWeakref_GetObject(PyObject * wr)
     52         int PyList_SetItem(object list, Py_ssize_t index, PyObject * item) except -1
     53 
     54     from cpython.object cimport PyObject_Hash
     55     cdef PyObject* PyDict_GetItemWithError(dict op, object key) except? NULL:
     56         cdef PyDictEntry* ep
     57         cdef PyDictObject* mp = <PyDictObject*><void *>op
---> 58         ep = mp.ma_lookup(mp, <PyObject*><void*>key, PyObject_Hash(key))
        global ep = undefined
        global mp.ma_lookup = undefined
        global mp = undefined
        global PyObject = undefined
        global void = undefined
        global key = undefined
        global PyObject_Hash = undefined
     59         if ep:
     60             return ep.me_value
     61         else:
     62             return NULL
     63 
     64     #this routine extracts the "dummy" sentinel value that is used in dicts to mark
     65     #"freed" slots. We need that to delete things ourselves.
     66 
     67     cdef PyObject* init_dummy() except NULL:
     68         cdef dict D = dict()
     69         cdef PyDictObject* mp = <PyDictObject *><void *>D
     70         cdef size_t mask
     71         cdef PyDictEntry* ep0 = mp.ma_table
     72         cdef PyDictEntry* ep
     73         cdef size_t i

/usr/lib/python2.7/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__hash__ (build/cythonized/sage/rings/real_lazy.c:9311)()
    691         except TypeError:
    692             pass
    693         left, right = self.approx(), other.approx()
    694         return richcmp(left.endpoints(), right.endpoints(), op)
    695 
    696     def __hash__(self):
    697         """
    698         Return the hash value of ``self``.
    699 
    700         EXAMPLES::
    701 
    702             sage: a = RLF(3)
    703             sage: hash(a)
    704             3
    705         """
--> 706         return hash(complex(self))
        global hash = undefined
        global complex = undefined
        global self = undefined
    707 
    708     cdef LazyFieldElement _new_wrapper(self, value):
    709         cdef LazyWrapper e = <LazyWrapper>LazyWrapper.__new__(LazyWrapper)
    710         e._parent = self._parent
    711         e._value = value
    712         return e
    713 
    714     cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op):
    715         cdef LazyBinop e = <LazyBinop>LazyBinop.__new__(LazyBinop)
    716         e._parent = self._parent
    717         e._left = left
    718         e._right = right
    719         e._op = op
    720         return e
    721 

/usr/lib/python2.7/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__complex__ (build/cythonized/sage/rings/real_lazy.c:10068)()
    805         """
    806         return self.eval(R)
    807 
    808     _real_mpfi_ = _complex_mpfi_ =_mpfr_ = _complex_mpfr_field_ = _generic_
    809 
    810     def __complex__(self):
    811         """
    812         Return ``self`` as a complex.
    813 
    814         EXAMPLES::
    815 
    816             sage: complex(CLF(-1)^(1/4))
    817             (0.707106781186547...+0.707106781186547...j)
    818         """
    819         try:
--> 820             return self.eval(complex)
        global self.eval = undefined
        global complex = undefined
    821         except Exception:
    822             from .complex_field import ComplexField
    823             return complex(self.eval(ComplexField(53)))
    824 
    825     cpdef eval(self, R):
    826         """
    827         Abstract method for converting ``self`` into an element of ``R``.
    828 
    829         EXAMPLES::
    830 
    831             sage: a = RLF(12)
    832             sage: a.eval(ZZ)
    833             12
    834         """
    835         raise NotImplementedError("Subclasses must override this method.")

/usr/lib/python2.7/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18537)()
   1592             sage: from sage.rings.real_lazy import LazyAlgebraic
   1593             sage: a = LazyAlgebraic(CLF, QQ['x'].cyclotomic_polynomial(7), 0.6+0.8*CC.0)
   1594             sage: a
   1595             0.6234898018587335? + 0.7818314824680299?*I
   1596             sage: ComplexField(150)(a) # indirect doctest
   1597             0.62348980185873353052500488400423981063227473 + 0.78183148246802980870844452667405775023233452*I
   1598 
   1599             sage: a = LazyAlgebraic(CLF, QQ['x'].0^2-7, -2.0)
   1600             sage: RR(a)
   1601             -2.64575131106459
   1602             sage: RR(a)^2
   1603             7.00000000000000
   1604         """
   1605         if isinstance(R, type):
   1606             if self._prec < 53:
-> 1607                 self.eval(self.parent().interval_field(64)) # up the prec
        global self.eval = undefined
        global self.parent.interval_field = undefined
   1608         elif R.is_exact() or self._prec < R.prec():
   1609             # Carl Witty said:
   1610             # Quadratic equation faster and more accurate than roots(),
   1611             # but the current code doesn't do the right thing with interval
   1612             # arithmetic (it returns a point interval) so it's being disabled
   1613             # for now
   1614 #             if self._quadratic_disc is not None:
   1615 #                 c, b, a = self._poly.list()
   1616 #                 if self._root_approx.real() < -b/2*a:
   1617 #                     z = (-b - R(self._quadratic_disc).sqrt()) / (2*a)
   1618 #                 else:
   1619 #                     z = (-b + R(self._quadratic_disc).sqrt()) / (2*a)
   1620 #                 if z.parent() is not R:
   1621 #                     z = R(z)
   1622 #                 self._root_approx = z

/usr/lib/python2.7/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18694)()
   1618 #                 else:
   1619 #                     z = (-b + R(self._quadratic_disc).sqrt()) / (2*a)
   1620 #                 if z.parent() is not R:
   1621 #                     z = R(z)
   1622 #                 self._root_approx = z
   1623 #                 from sage.rings.complex_interval_field import is_IntervalField
   1624 #                 if is_IntervalField(R):
   1625 #                     self._root_approx = (self._root_approx.upper() + self._root_approx.lower()) / 2
   1626 #                 self._prec = R.prec()
   1627 #                 return R(self._root_approx)
   1628             if self._root is None:
   1629                 # This could be done much more efficiently with Newton iteration,
   1630                 # but will require some care to make sure we get the right root, and
   1631                 # to the correct precision.
   1632                 from sage.rings.qqbar import AA, QQbar
-> 1633                 roots = self._poly.roots(ring = AA if isinstance(self._parent, RealLazyField_class) else QQbar)
        global roots = undefined
        global self._poly.roots = undefined
        global ring = undefined
        global AA = undefined
        global isinstance = undefined
        global self._parent = undefined
        global RealLazyField_class = <class 'sage.rings.real_lazy.RealLazyField_class'>
        global QQbar = undefined
   1634                 best_root = roots[0][0]
   1635                 min_dist = abs(self._root_approx - best_root)
   1636                 for r, e in roots[1:]:
   1637                     dist = abs(self._root_approx - r)
   1638                     if dist < min_dist:
   1639                         best_root = r
   1640                         min_dist = dist
   1641                 self._root = best_root
   1642         if self._root is not None:
   1643             return R(self._root)
   1644 
   1645     def __float__(self):
   1646         """
   1647         TESTS::
   1648 

/usr/lib/python2.7/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:69561)()
   7613 
   7614                 if multiplicities:
   7615                     return rts
   7616                 else:
   7617                     return [rt for (rt, mult) in rts]
   7618 
   7619             if (is_IntegerRing(K) or is_RationalField(K)
   7620                 or is_AlgebraicField_common(K) or input_gaussian) and \
   7621                 (is_ComplexIntervalField(L) or is_AlgebraicField_common(L)):
   7622 
   7623                 from sage.rings.polynomial.complex_roots import complex_roots
   7624 
   7625                 if is_ComplexIntervalField(L):
   7626                     rts = complex_roots(self, min_prec=L.prec())
   7627                 elif is_AlgebraicField(L):
-> 7628                     rts = complex_roots(self, retval='algebraic')
        global rts = undefined
        global complex_roots = undefined
        global self = undefined
        global retval = undefined
   7629                 else:
   7630                     rts = complex_roots(self, retval='algebraic_real')
   7631 
   7632                 if multiplicities:
   7633                     return rts
   7634                 else:
   7635                     return [rt for (rt, mult) in rts]
   7636 
   7637             if output_fp and output_complex and not input_gaussian:
   7638                 # If we want the complex roots, and the input is not
   7639                 # floating point, we convert to a real polynomial
   7640                 # (except when the input coefficients are Gaussian rationals).
   7641                 if is_ComplexDoubleField(L):
   7642                     real_field = RDF
   7643                 else:

/usr/lib/python2.7/dist-packages/sage/rings/polynomial/complex_roots.pyc in complex_roots(p=x^2 + 1, skip_squarefree=False, retval='algebraic', min_prec=0)
    243     if skip_squarefree:
    244         factors = [(p, 1)]
    245     else:
    246         factors = p.squarefree_decomposition()
    247 
    248     prec = 53
    249     while True:
    250         CC = ComplexField(prec)
    251         CCX = CC['x']
    252 
    253         all_rts = []
    254         ok = True
    255 
    256         for (factor, exp) in factors:
    257             cfac = CCX(factor)
--> 258             rts = cfac.roots(multiplicities=False)
        rts = undefined
        cfac.roots = <built-in method roots of PolynomialRing_field_with_category.element_class object at 0x7fc5e80839f0>
        global multiplicities = undefined
        global False = undefined
    259             # Make sure the number of roots we found is the degree. If
    260             # we don't find that many roots, it's because the
    261             # precision isn't big enough and though the (possibly
    262             # exact) polynomial "factor" is squarefree, it is not
    263             # squarefree as an element of CCX.
    264             if len(rts) < factor.degree():
    265                 ok = False
    266                 break
    267             irts = interval_roots(factor, rts, max(prec, min_prec))
    268             if irts is None:
    269                 ok = False
    270                 break
    271             if retval != 'interval':
    272                 factor = QQbar.common_polynomial(factor)
    273             for irt in irts:

/usr/lib/python2.7/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:66289)()
   7521                     ext_rts1 = numpy.roots(numpy_array)
   7522                     rts = []
   7523                     for rt in ext_rts1:
   7524                         rts.append(CDF(rt))
   7525                     rts.sort()
   7526                     ext_rts = rts
   7527                 except (ValueError, LinAlgError):
   7528                     if algorithm == 'either':
   7529                         algorithm = 'pari'
   7530                     else:
   7531                         raise
   7532 
   7533             if algorithm == 'pari':
   7534                 if not input_arbprec:
   7535                     self = self.change_ring(CC if input_complex else RR)
-> 7536                 ext_rts = self.__pari__().polroots(precision=L.prec())
        global ext_rts = undefined
        global self.__pari__.polroots = undefined
        global precision = undefined
        global L.prec = undefined
   7537 
   7538             if output_complex:
   7539                 rts = sort_complex_numbers_for_display([L(root) for root in ext_rts])
   7540             else:
   7541                 rts = sorted([L(root.real()) for root in ext_rts if root.imag() == 0])
   7542 
   7543             rts_mult = []
   7544             j = 0
   7545             while j < len(rts):
   7546                 rt = rts[j]
   7547                 mult = rts.count(rt)
   7548                 rts_mult.append((rt, mult))
   7549                 j += mult
   7550 
   7551             if multiplicities:

/usr/lib/python2.7/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.__pari__ (build/cythonized/sage/rings/polynomial/polynomial_element.c:53916)()
   5933             sage: R.<x> = S['x']
   5934             sage: pari(x^2 + 9*x)
   5935             x^2 + 2*x
   5936             sage: pari(a*x + 9*b*x^3)
   5937             2*b*x^3 + a*x
   5938 
   5939         ::
   5940 
   5941             sage: S.<a> = Integers(8)['a']
   5942             sage: R.<x> = S['x']
   5943             sage: pari(x^2 + 2*x)
   5944             Mod(1, 8)*x^2 + Mod(2, 8)*x
   5945             sage: pari(a*x + 10*x^3)
   5946             Mod(2, 8)*x^3 + Mod(1, 8)*a*x
   5947         """
-> 5948         return self._pari_with_name(self._parent.variable_name())
        global self._pari_with_name = undefined
        global self._parent.variable_name = undefined
   5949 
   5950     def _pari_or_constant(self, name=None):
   5951         r"""
   5952         Convert ``self`` to PARI.  This behaves identical to :meth:`__pari__`
   5953         or :meth:`_pari_with_name` except for constant polynomials:
   5954         then the constant is returned instead of a constant polynomial.
   5955 
   5956         INPUT:
   5957 
   5958         - ``name`` -- (default: None) Variable name.  If not given, use
   5959           ``self.parent().variable_name()``.  This argument is irrelevant
   5960           for constant polynomials.
   5961 
   5962         EXAMPLES::
   5963 

/usr/lib/python2.7/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial._pari_with_name (build/cythonized/sage/rings/polynomial/polynomial_element.c:54381)()
   5986     def _pari_with_name(self, name='x'):
   5987         r"""
   5988         Return polynomial as a PARI object with topmost variable
   5989         ``name``.  By default, use 'x' for the variable name.
   5990 
   5991         For internal use only.
   5992 
   5993         EXAMPLES:
   5994 
   5995             sage: R.<a> = PolynomialRing(ZZ)
   5996             sage: (2*a^2 + a)._pari_with_name()
   5997             2*x^2 + x
   5998             sage: (2*a^2 + a)._pari_with_name('y')
   5999             2*y^2 + y
   6000         """
-> 6001         vals = [x.__pari__() for x in self.list()]
        global vals = undefined
        global x.__pari__ = undefined
        global x = undefined
        global self.list = undefined
   6002         return pari(vals).Polrev(name)
   6003 
   6004     def _pari_init_(self):
   6005         return repr(self.__pari__())
   6006 
   6007     def _magma_init_(self, magma):
   6008         """
   6009         Return a string that evaluates in Magma to this polynomial.
   6010 
   6011         EXAMPLES::
   6012 
   6013             sage: magma = Magma()  # new session
   6014             sage: R.<y> = ZZ[]
   6015             sage: f = y^3 - 17*y + 5
   6016             sage: f._magma_init_(magma)        # optional - magma

/usr/lib/python2.7/dist-packages/sage/rings/complex_number.pyx in sage.rings.complex_number.ComplexNumber.__pari__ (build/cythonized/sage/rings/complex_number.c:7370)()
    579             <type 'cypari2.gen.Gen'>
    580             sage: a.__pari__()
    581             2.00000000000000 + 1.00000000000000*I
    582             sage: type(a.__pari__())
    583             <type 'cypari2.gen.Gen'>
    584             sage: a = CC(pi)
    585             sage: pari(a)
    586             3.14159265358979
    587             sage: pari(a).type()
    588             't_REAL'
    589             sage: a = CC(-2).sqrt()
    590             sage: pari(a)
    591             1.41421356237310*I
    592         """
    593         if self.is_real():
--> 594             return self.real().__pari__()
        global self.real.__pari__ = undefined
    595         return sage.libs.pari.all.pari.complex(self.real() or 0, self.imag())
    596 
    597     def __mpc__(self):
    598         """
    599         Convert Sage ``ComplexNumber`` to gmpy2 ``mpc``.
    600 
    601         EXAMPLES::
    602 
    603             sage: c = ComplexNumber(2,1)
    604             sage: c.__mpc__()               # optional - gmpy2
    605             mpc('2.0+1.0j')
    606             sage: from gmpy2 import mpc     # optional - gmpy2
    607             sage: mpc(c)                    # optional - gmpy2
    608             mpc('2.0+1.0j')
    609             sage: CF = ComplexField(134)    

/usr/lib/python2.7/dist-packages/sage/rings/real_mpfr.pyx in sage.rings.real_mpfr.RealNumber.__pari__ (build/cythonized/sage/rings/real_mpfr.c:23306)()
   3185         Check that the largest and smallest exponents representable by
   3186         PARI convert correctly::
   3187 
   3188             sage: a = pari(0.5) << (sys.maxsize+1)/4
   3189             sage: RR(a) >> (sys.maxsize+1)/4
   3190             0.500000000000000
   3191             sage: a = pari(0.5) >> (sys.maxsize-3)/4
   3192             sage: RR(a) << (sys.maxsize-3)/4
   3193             0.500000000000000
   3194         """
   3195         # This uses interfaces of MPFR and PARI which are documented
   3196         # (and not marked subject-to-change).  It could be faster
   3197         # by using internal interfaces of MPFR, which are documented
   3198         # as subject-to-change.
   3199 
-> 3200         sig_on()
        global sig_on = undefined
   3201         if mpfr_nan_p(self.value) or mpfr_inf_p(self.value):
   3202             raise ValueError('Cannot convert NaN or infinity to Pari float')
   3203 
   3204         # wordsize for PARI
   3205         cdef unsigned long wordsize = sizeof(long)*8
   3206 
   3207         cdef int prec
   3208         prec = (<RealField_class>self._parent).__prec
   3209 
   3210         # We round up the precision to the nearest multiple of wordsize.
   3211         cdef int rounded_prec
   3212         rounded_prec = (self.prec() + wordsize - 1) & ~(wordsize - 1)
   3213 
   3214         # Yes, assigning to self works fine, even in Cython.
   3215         if rounded_prec > prec:

SignalError: Segmentation fault

***************************************************************************

History of session input:
*** Last line of input (may not be in above history):


More information about the debian-science-maintainers mailing list