Bug#974991: sagemath: segfault on startup

G.raud graud at gmx.com
Tue Nov 17 18:01:59 GMT 2020


Package: sagemath
Version: 9.2-1
Severity: important

Dear Maintainers,

Starting sage in a terminal to get a prompt makes it segfault (it seems
related to pari).  The end of the terminal output follows and the
complete log file is attached.  Sage also segfaults when started by
jupyter.

---
$ sage
[...]
   3310         return new_gen(pari_float)

SignalError: Segmentation fault

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

Oops, Sage crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
  - A verbatim copy of the crash traceback.
  - A copy of your input history during this session.
  - Data on your current Sage configuration.

It was left in the file named:
        '/home/restricted/.ipython/Sage_crash_report.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.

You can mail it to: sage-support at sage-support at googlegroups.com
with the subject 'Sage Crash Report'.

If you want to do it now, the following command will work (under Unix):
mail -s 'Sage Crash Report' sage-support at googlegroups.com < /home/restricted/.ipython/Sage_crash_report.txt

In your email, please also include information about:
- The operating system under which the crash happened: Linux, macOS, Windows,
  other, and which exact version (for example: Ubuntu 16.04.3, macOS 10.13.2,
  Windows 10 Pro), and whether it is 32-bit or 64-bit;
- How Sage was installed: using pip or conda, from GitHub, as part of
  a Docker container, or other, providing more detail if possible;
- How to reproduce the crash: what exact sequence of instructions can one
  input to get the same crash? Ideally, find a minimal yet complete sequence
  of instructions that yields the crash.

To ensure accurate tracking of this issue, please file a report about it at:
http://trac.sagemath.org

Hit <Enter> to quit (your terminal may close):
---



-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (800, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (99, 'xenial-updates'), (99, 'xenial-security'), (99, 'xenial'), (10, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-12-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages sagemath depends on:
ii  curl                                              7.72.0-1
ii  cysignals-tools                                   1.10.2+ds-5
ii  cython3                                           0.29.21-3
ii  ecl                                               20.4.24+ds-2
ii  eclib-tools                                       20190909-3+b1
ii  fflas-ffpack                                      2.4.3-2
ii  flintqs                                           1:1.0-3+b1
ii  gap-atlasrep                                      2.1.0-3
ii  gap-dev                                           4.11.0-4
ii  gap-online-help                                   4.11.0-4
ii  gap-primgrp                                       3.4.0-1
ii  gap-smallgrp                                      1.4.1-1
ii  gap-table-of-marks                                1.2.9-1
ii  gap-transgrp                                      2.0.4-1
ii  gfan                                              0.6.2-2
ii  glpk-utils                                        4.65-2
ii  gmp-ecm                                           7.0.4+ds-5
ii  ipython3                                          7.19.0-1
ii  iso-codes                                         4.5.0-1
ii  jmol                                              14.6.4+2016.11.05+dfsg1-4
ii  lcalc                                             1.23+dfsg-11+b1
ii  less                                              551-2
ii  libatlas3-base [libblas.so.3]                     3.10.3-10
ii  libblas3 [libblas.so.3]                           3.9.0-3
ii  libbraiding0                                      1.0-1+b1
ii  libbrial-groebner3                                1.2.10-1+b1
ii  libbrial3                                         1.2.10-1+b1
ii  libc6                                             2.31-4
ii  libcdd-tools                                      094j-2
ii  libcliquer1                                       1.21-2
ii  libec5                                            20190909-3+b1
ii  libecm1                                           7.0.4+ds-5
ii  libflint-2.6.3                                    2.6.3-3
ii  libflint-arb2                                     1:2.18.1-3
ii  libgap7                                           4.11.0-4
ii  libgcc-s1                                         10.2.0-17
ii  libgd3                                            2.3.0-2
ii  libgiac0                                          1.6.0.25+dfsg1-3
ii  libgivaro9                                        4.1.1-2
ii  libglpk40                                         4.65-2
ii  libgmp10                                          2:6.2.1+dfsg-1
ii  libgmpxx4ldbl                                     2:6.2.1+dfsg-1
ii  libgomp1                                          10.2.0-17
ii  libgsl25                                          2.6+dfsg-2
ii  libhomfly0                                        1.02r6-1
ii  libiml0                                           1.0.4-1+b2
ii  libjs-mathjax                                     2.7.9+dfsg-1
ii  libjs-three                                       111+dfsg1-1
ii  liblfunction0                                     1.23+dfsg-11+b1
ii  liblrcalc1                                        1.2-2+b1
ii  libm4ri-0.0.20200125                              20200125-1+b1
ii  libm4rie-0.0.20200125                             20200125-1+b2
ii  libmpc3                                           1.2.0-1
ii  libmpfi0                                          1.5.3+ds-5
ii  libmpfr6                                          4.1.0-3
ii  libntl43                                          11.4.3-1+b1
ii  libopenblas0                                      0.3.12+ds-2
ii  libopenblas0-pthread [libblas.so.3]               0.3.12+ds-2
ii  libpari-gmp-tls6                                  2.11.4-3
ii  libplanarity0                                     3.0.1.0-1
ii  libpynac18py3                                     0.7.26-5
ii  libratpoints-2.1.3                                1:2.1.3-1+b2
ii  libreadline8                                      8.1~rc2-2
ii  librw0                                            0.9+ds1-1
ii  libsingular4m1                                    1:4.1.1-p2+ds-4+b2
ii  libstdc++6                                        10.2.0-17
ii  libsymmetrica2                                    2.0+ds-6
ii  libzn-poly-0.9                                    0.9.2-1
ii  maxima-sage                                       5.44.0-1
ii  maxima-sage-share                                 5.44.0-1
ii  nauty                                             2.7r1+ds-1
ii  palp                                              2.20-1
ii  pari-elldata                                      0.20190911-1
ii  pari-galdata                                      0.20080411-3
ii  pari-galpol                                       4.0-1
ii  pari-gp                                           2.13.0-2
ii  pari-gp2c                                         0.0.12-1
ii  pari-seadata                                      0.20090618-2
ii  python-ppl-doc                                    0.8.4-4
ii  python3                                           3.8.6-1
ii  python3-alabaster                                 0.7.8-1.1
ii  python3-babel                                     2.8.0+dfsg.1-4
ii  python3-cvxopt                                    1.2.5+dfsg-3
ii  python3-cycler                                    0.10.0-3
ii  python3-cypari2                                   2.1.2-1
ii  python3-cysignals-pari                            1.10.2+ds-5
ii  python3-decorator                                 4.4.2-2
ii  python3-docutils                                  0.16+dfsg-3
ii  python3-fpylll                                    0.5.2+ds1-2+b1
ii  python3-future                                    0.18.2-4
ii  python3-gmpy2                                     2.1.0~b5-0.1+b1
ii  python3-imagesize                                 1.2.0-2
ii  python3-ipython-genutils                          0.2.0-4
ii  python3-itsdangerous                              1.1.0-3
ii  python3-matplotlib                                3.3.2-2
ii  python3-mistune                                   0.8.4-4
ii  python3-mpmath                                    1.1.0-2
ii  python3-networkx                                  2.5+ds-2
ii  python3-nose                                      1.3.7-7
ii  python3-numpy [python3-numpy-abi9]                1:1.19.4-1
ii  python3-packaging                                 20.4-1
ii  python3-path                                      15.0.0-1
ii  python3-pexpect                                   4.6.0-4
ii  python3-pickleshare                               0.7.5-3
ii  python3-pil                                       8.0.1-1
ii  python3-pip                                       20.1.1-2
ii  python3-pkgconfig                                 1.5.1-3
ii  python3-ppl                                       0.8.4-4+b2
ii  python3-psutil                                    5.7.3-1
ii  python3-ptyprocess                                0.6.0-3
ii  python3-pygments                                  2.7.1+dfsg-1
ii  python3-rpy2 [python3-rpy2]                       3.3.6-1+b1
ii  python3-scipy                                     1.5.4-1
ii  python3-setuptools                                50.3.0-1
ii  python3-setuptools-scm                            4.1.2-4
ii  python3-simplegeneric                             0.8.1-3
ii  python3-singledispatch                            3.4.0.3-3
ii  python3-snowballstemmer                           2.0.0-2
ii  python3-sphinx                                    3.3.1-1
ii  python3-stemmer                                   2.0.1+dfsg-1+b1
ii  python3-sympy                                     1.6.2-2
ii  python3-terminado                                 0.9.1-1
ii  python3-tk                                        3.8.6-1
ii  python3-tornado                                   6.1.0-1
ii  python3-traitlets                                 5.0.5-1
ii  python3-tz                                        2020.4-2
ii  python3-vcversioner                               2.16.0.0-3
ii  python3-wcwidth                                   0.1.9+dfsg1-2
ii  python3-werkzeug                                  1.0.1+dfsg1-2
ii  python3-zmq                                       20.0.0-1
ii  python3-zope.interface                            5.1.2-1
ii  r-base-core                                       4.0.3-1
ii  rubiks                                            20070912-5
ii  sagemath-common                                   9.2-1
ii  sagemath-database-conway-polynomials              0.5-8
ii  sagemath-database-elliptic-curves                 0.8.1-5
ii  sagemath-database-graphs                          20161026+dfsg-5
ii  sagemath-database-mutually-combinatorial-designs  20140630-6
ii  sagemath-database-polytopes                       20170220-5
ii  singular                                          1:4.1.1-p2+ds-4+b2
ii  sqlite3                                           3.33.0-1
ii  sympow                                            2.023.6-1
ii  tachyon                                           0.99~b6+dsx-9
ii  xcas                                              1.6.0.25+dfsg1-3
ii  yasm                                              1.3.0-2+b1

Versions of packages sagemath recommends:
ii  maxima-sage-doc        5.44.0-1
ii  pari-doc               2.13.0-2
ii  python3-sagenb-export  3.2-4
ii  r-cran-lattice         0.20-41-1+b1
ii  sagemath-doc           9.2-1
ii  sagemath-jupyter       9.2-1
ii  sagetex                3.4+ds-2
ii  singular-doc           1:4.1.1-p2+ds-4
ii  texlive-latex-base     2020.20200925-1

Versions of packages sagemath suggests:
ii  dot2tex      2.11.3-2
pn  gap-design   <none>
ii  gap-factint  1.6.3+ds-1
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': '<not found>',
 'commit_source': '(none found)',
 'default_encoding': 'utf-8',
 'ipython_path': '/usr/lib/python3/dist-packages/IPython',
 'ipython_version': '7.19.0',
 'os_name': 'posix',
 'platform': 'Linux-4.19.0-12-amd64-x86_64-with-glibc2.29',
 'sys_executable': '/usr/bin/python3',
 'sys_platform': 'linux',
 'sys_version': '3.8.6 (default, Sep 25 2020, 09:36:53) \n[GCC 10.2.0]'}

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



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

Crash traceback:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
SignalError                                  Python 3.8.6: /usr/bin/python3
                                                   Tue Nov 17 18:14:51 2020
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 sage-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 TerminalIPythonApp.initialize of <sage.repl.interpreter.SageTerminalApp object at 0x7f426061f880>>
     16 app.start()

/usr/lib/python3/dist-packages/traitlets/config/application.py in inner(app=<sage.repl.interpreter.SageTerminalApp object>, *args=(), **kwargs={})
     72 else:
     73     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 )
     74
     75
     76 def catch_config_error(method):
     77     """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
     78
     79     On a TraitError (generally caused by bad config), this will print the trait's
     80     message, and exit the app.
     81
     82     For use on init methods, to prevent invoking excepthook on invalid input.
     83     """
     84     @functools.wraps(method)
     85     def inner(app, *args, **kwargs):
     86         try:
---> 87             return method(app, *args, **kwargs)
        global method = undefined
        app = <sage.repl.interpreter.SageTerminalApp object at 0x7f426061f880>
        args = ()
        kwargs = {}
     88         except (TraitError, ArgumentError) as e:
     89             app.log.fatal("Bad config encountered during initialization: %s", e)
     90             app.log.debug("Config at the time: %s", app.config)
     91             app.exit(1)
     92
     93     return inner
     94
     95 class ApplicationError(Exception):
     96     pass
     97
     98
     99 class LevelFormatter(logging.Formatter):
    100     """Formatter with additional `highlevel` record
    101
    102     This field is empty if log level is less than highlevel_limit,

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

/usr/lib/python3/dist-packages/sage/repl/interpreter.py in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
    776         self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions
    777
    778         # Load the %lprun extension if available
    779         try:
    780             import line_profiler
    781         except ImportError:
    782             pass
    783         else:
    784             self.extensions.append('line_profiler')
    785
    786         if self.shell.has_sage_extensions:
    787             self.extensions.remove(SAGE_EXTENSION)
    788
    789             # load sage extension here to get a crash if
    790             # something is wrong with the sage library
--> 791             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 0x7f425cef9670>>
        global SAGE_EXTENSION = 'sage'
    792
    793

/usr/lib/python3/dist-packages/IPython/core/extensions.py in load_extension(self=<IPython.core.extensions.ExtensionManager object>, module_str='sage')
     72         if module_str in self.loaded:
     73             return "already loaded"
     74
     75         from IPython.utils.syspathcontext import prepended_to_syspath
     76
     77         with self.shell.builtin_trap:
     78             if module_str not in sys.modules:
     79                 with prepended_to_syspath(self.ipython_extension_dir):
     80                     mod = import_module(module_str)
     81                     if mod.__file__.startswith(self.ipython_extension_dir):
     82                         print(("Loading extensions from {dir} is deprecated. "
     83                                "We recommend managing extensions like any "
     84                                "other Python packages, in site-packages.").format(
     85                               dir=compress_user(self.ipython_extension_dir)))
     86             mod = sys.modules[module_str]
---> 87             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 0x7f425cef9670>>
        mod = <module 'sage' from '/usr/lib/python3/dist-packages/sage/__init__.py'>
     88                 self.loaded.add(module_str)
     89             else:
     90                 return "no load function"
     91
     92     def unload_extension(self, module_str):
     93         """Unload an IPython extension by its module name.
     94
     95         This function looks up the extension's name in ``sys.modules`` and
     96         simply calls ``mod.unload_ipython_extension(self)``.
     97
     98         Returns the string "no unload function" if the extension doesn't define
     99         a function to unload itself, "not loaded" if the extension isn't loaded,
    100         otherwise None.
    101         """
    102         if module_str not in self.loaded:

/usr/lib/python3/dist-packages/IPython/core/extensions.py in _call_load_ipython_extension(self=<IPython.core.extensions.ExtensionManager object>, mod=<module 'sage' from '/usr/lib/python3/dist-packages/sage/__init__.py'>)
    119         """
    120         from IPython.utils.syspathcontext import prepended_to_syspath
    121
    122         if (module_str in self.loaded) and (module_str in sys.modules):
    123             self.unload_extension(module_str)
    124             mod = sys.modules[module_str]
    125             with prepended_to_syspath(self.ipython_extension_dir):
    126                 reload(mod)
    127             if self._call_load_ipython_extension(mod):
    128                 self.loaded.add(module_str)
    129         else:
    130             self.load_extension(module_str)
    131
    132     def _call_load_ipython_extension(self, mod):
    133         if hasattr(mod, 'load_ipython_extension'):
--> 134             mod.load_ipython_extension(self.shell)
        mod.load_ipython_extension = <function load_ipython_extension at 0x7f42605c8f70>
        self.shell = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f425ed46fa0>
    135             return True
    136
    137     def _call_unload_ipython_extension(self, mod):
    138         if hasattr(mod, 'unload_ipython_extension'):
    139             mod.unload_ipython_extension(self.shell)
    140             return True
    141
    142     @undoc
    143     def install_extension(self, url, filename=None):
    144         """
    145         Deprecated.
    146         """
    147         # Ensure the extension directory exists
    148         raise DeprecationWarning(
    149             '`install_extension` and the `install_ext` magic have been deprecated since IPython 4.0'

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

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

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

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

/usr/lib/python3/dist-packages/sage/all.py in <module>
    127 from sage.misc.all       import *         # takes a while
    128 from sage.typeset.all    import *
    129 from sage.repl.all       import *
    130
    131 from sage.misc.sh import sh
    132
    133 from sage.libs.all       import *
    134 from sage.data_structures.all import *
    135 from sage.doctest.all    import *
    136
    137 from sage.structure.all  import *
    138 from sage.rings.all      import *
    139 from sage.arith.all      import *
    140 from sage.matrix.all     import *
    141
--> 142 from sage.symbolic.all   import *
        global sage.symbolic.all = undefined
    143 from sage.modules.all    import *
    144 from sage.monoids.all    import *
    145 from sage.algebras.all   import *
    146 from sage.modular.all    import *
    147 from sage.sat.all        import *
    148 from sage.schemes.all    import *
    149 from sage.graphs.all     import *
    150 from sage.groups.all     import *
    151 from sage.arith.power    import generic_power as power
    152 from sage.databases.all  import *
    153 from sage.categories.all import *
    154 from sage.sets.all       import *
    155 from sage.probability.all import *
    156 from sage.interfaces.all import *
    157

/usr/lib/python3/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
     16
     17 π = pi

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

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

/usr/lib/python3/dist-packages/sage/rings/number_field/number_field.py in QuadraticField(D=-1, name='I', check=True, embedding=1.00000000000000*I, latex_name='i', **args={})
    965     D = QQ(D)
    966     if check:
    967         if D.is_square():
    968             raise ValueError("D must not be a perfect square.")
    969     R = QQ['x']
    970     f = R([-D, 0, 1])
    971     if embedding is True:
    972         if D > 0:
    973             embedding = RLF(D).sqrt()
    974         else:
    975             embedding = CLF(D).sqrt()
    976     elif embedding is False:
    977         embedding = None
    978     if latex_name == 'sqrt':
    979         latex_name = r'\sqrt{%s}' % D
--> 980     return NumberField(f, name, check=False, embedding=embedding, latex_name=latex_name, **args)
        global NumberField = <function NumberField at 0x7f41c559af70>
        f = x^2 + 1
        name = 'I'
        check = True
        embedding = 1.00000000000000*I
        latex_name = 'i'
        args = {}
    981
    982 def is_AbsoluteNumberField(x):
    983     """
    984     Return True if x is an absolute number field.
    985
    986     EXAMPLES::
    987
    988         sage: from sage.rings.number_field.number_field import is_AbsoluteNumberField
    989         sage: is_AbsoluteNumberField(NumberField(x^2+1,'a'))
    990         True
    991         sage: is_AbsoluteNumberField(NumberField([x^3 + 17, x^2+1],'a'))
    992         False
    993
    994     The rationals are a number field, but they're not of the absolute
    995     number field class.

/usr/lib/python3/dist-packages/sage/rings/number_field/number_field.py 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, latex_names=None, **kwds={})
    543                        [0 0 0 1]
    544                        [2 0 0 0]
    545     """
    546     if names is not None:
    547         name = names
    548     if latex_names is not None:
    549         latex_name = latex_names
    550     for key, val in kwds.items():
    551         if key not in ['implementation', 'prec']:
    552             raise TypeError("NumberField() got an unexpected keyword argument '%s'"%key)
    553         if not (val is None or isinstance(val, list) and all(c is None for c in val)):
    554             raise NotImplementedError("Number field with prescribed %s is not implemented"%key)
    555     if isinstance(polynomial, (list,tuple)):
    556         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)
    557
--> 558     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 0x7f41c515b4f0>
        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
    559
    560 class NumberFieldFactory(UniqueFactory):
    561     r"""
    562     Factory for number fields.
    563
    564     This should usually not be called directly, use :meth:`NumberField`
    565     instead.
    566
    567     INPUT:
    568
    569         - ``polynomial`` - a polynomial over `\QQ` or a number field.
    570         - ``name`` - a string (default: ``'a'``), the name of the generator
    571         - ``check`` - a boolean (default: ``True``); do type checking and
    572           irreducibility checking.
    573         - ``embedding`` - ``None`` or an element, the images of the generator

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

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

/usr/lib/python3/dist-packages/sage/misc/weak_dict.pyx in sage.misc.weak_dict.WeakValueDictionary.__getitem__ (build/cythonized/sage/misc/weak_dict.c:3685)()
    687
    688             sage: D[10] = ZZ
    689             sage: D[int(10)]
    690             Integer Ring
    691
    692         Check that :trac:`15956` has been fixed, i.e., a ``TypeError`` is
    693         raised for unhashable objects::
    694
    695             sage: D = sage.misc.weak_dict.WeakValueDictionary()
    696             sage: D[matrix([])]
    697             Traceback (most recent call last):
    698             ...
    699             TypeError: mutable matrices are unhashable
    700
    701         """
--> 702         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
    703         if wr == NULL:
    704             raise KeyError(k)
    705         out = PyWeakref_GetObject(wr)
    706         if out == Py_None:
    707             raise KeyError(k)
    708         return <object>out
    709
    710     def __contains__(self, k):
    711         """
    712         Containment in the set of keys.
    713
    714         TESTS::
    715
    716             sage: import sage.misc.weak_dict
    717             sage: class Vals(object): pass

/usr/lib/python3/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__hash__ (build/cythonized/sage/rings/real_lazy.c:9288)()
    673         except TypeError:
    674             pass
    675         left, right = self.approx(), other.approx()
    676         return richcmp(left.endpoints(), right.endpoints(), op)
    677
    678     def __hash__(self):
    679         """
    680         Return the hash value of ``self``.
    681
    682         EXAMPLES::
    683
    684             sage: a = RLF(3)
    685             sage: hash(a)
    686             3
    687         """
--> 688         return hash(complex(self))
        global hash = undefined
        global complex = undefined
        global self = undefined
    689
    690     cdef LazyFieldElement _new_wrapper(self, value):
    691         cdef LazyWrapper e = <LazyWrapper>LazyWrapper.__new__(LazyWrapper)
    692         e._parent = self._parent
    693         e._value = value
    694         return e
    695
    696     cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op):
    697         cdef LazyBinop e = <LazyBinop>LazyBinop.__new__(LazyBinop)
    698         e._parent = self._parent
    699         e._left = left
    700         e._right = right
    701         e._op = op
    702         return e
    703

/usr/lib/python3/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__complex__ (build/cythonized/sage/rings/real_lazy.c:10067)()
    787         """
    788         return self.eval(R)
    789
    790     _real_mpfi_ = _complex_mpfi_ =_mpfr_ = _complex_mpfr_field_ = _generic_
    791
    792     def __complex__(self):
    793         """
    794         Return ``self`` as a complex.
    795
    796         EXAMPLES::
    797
    798             sage: complex(CLF(-1)^(1/4))
    799             (0.707106781186547...+0.707106781186547...j)
    800         """
    801         try:
--> 802             return self.eval(complex)
        global self.eval = undefined
        global complex = undefined
    803         except Exception:
    804             from .complex_field import ComplexField
    805             return complex(self.eval(ComplexField(53)))
    806
    807     cpdef eval(self, R):
    808         """
    809         Abstract method for converting ``self`` into an element of ``R``.
    810
    811         EXAMPLES::
    812
    813             sage: a = RLF(12)
    814             sage: a.eval(ZZ)
    815             12
    816         """
    817         raise NotImplementedError("Subclasses must override this method.")

/usr/lib/python3/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18284)()
   1612             sage: from sage.rings.real_lazy import LazyAlgebraic
   1613             sage: a = LazyAlgebraic(CLF, QQ['x'].cyclotomic_polynomial(7), 0.6+0.8*CC.0)
   1614             sage: a
   1615             0.6234898018587335? + 0.7818314824680299?*I
   1616             sage: ComplexField(150)(a) # indirect doctest
   1617             0.62348980185873353052500488400423981063227473 + 0.78183148246802980870844452667405775023233452*I
   1618
   1619             sage: a = LazyAlgebraic(CLF, QQ['x'].0^2-7, -2.0)
   1620             sage: RR(a)
   1621             -2.64575131106459
   1622             sage: RR(a)^2
   1623             7.00000000000000
   1624         """
   1625         if isinstance(R, type):
   1626             if self._prec < 53:
-> 1627                 self.eval(self.parent().interval_field(64)) # up the prec
        global self.eval = undefined
        global self.parent.interval_field = undefined
   1628         elif R.is_exact() or self._prec < R.prec():
   1629             # Carl Witty said:
   1630             # Quadratic equation faster and more accurate than roots(),
   1631             # but the current code doesn't do the right thing with interval
   1632             # arithmetic (it returns a point interval) so it's being disabled
   1633             # for now
   1634 #             if self._quadratic_disc is not None:
   1635 #                 c, b, a = self._poly.list()
   1636 #                 if self._root_approx.real() < -b/2*a:
   1637 #                     z = (-b - R(self._quadratic_disc).sqrt()) / (2*a)
   1638 #                 else:
   1639 #                     z = (-b + R(self._quadratic_disc).sqrt()) / (2*a)
   1640 #                 if z.parent() is not R:
   1641 #                     z = R(z)
   1642 #                 self._root_approx = z

/usr/lib/python3/dist-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18435)()
   1638 #                 else:
   1639 #                     z = (-b + R(self._quadratic_disc).sqrt()) / (2*a)
   1640 #                 if z.parent() is not R:
   1641 #                     z = R(z)
   1642 #                 self._root_approx = z
   1643 #                 from sage.rings.complex_interval_field import is_IntervalField
   1644 #                 if is_IntervalField(R):
   1645 #                     self._root_approx = (self._root_approx.upper() + self._root_approx.lower()) / 2
   1646 #                 self._prec = R.prec()
   1647 #                 return R(self._root_approx)
   1648             if self._root is None:
   1649                 # This could be done much more efficiently with Newton iteration,
   1650                 # but will require some care to make sure we get the right root, and
   1651                 # to the correct precision.
   1652                 from sage.rings.qqbar import AA, QQbar
-> 1653                 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
   1654                 best_root = roots[0][0]
   1655                 min_dist = abs(self._root_approx - best_root)
   1656                 for r, e in roots[1:]:
   1657                     dist = abs(self._root_approx - r)
   1658                     if dist < min_dist:
   1659                         best_root = r
   1660                         min_dist = dist
   1661                 self._root = best_root
   1662         if self._root is not None:
   1663             return R(self._root)
   1664
   1665     def __float__(self):
   1666         """
   1667         TESTS::
   1668

/usr/lib/python3/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:64123)()
   7895
   7896                 if multiplicities:
   7897                     return rts
   7898                 else:
   7899                     return [rt for (rt, mult) in rts]
   7900
   7901             if (is_IntegerRing(K) or is_RationalField(K)
   7902                 or is_AlgebraicField_common(K) or input_gaussian) and \
   7903                 (is_ComplexIntervalField(L) or is_AlgebraicField_common(L)):
   7904
   7905                 from sage.rings.polynomial.complex_roots import complex_roots
   7906
   7907                 if is_ComplexIntervalField(L):
   7908                     rts = complex_roots(self, min_prec=L.prec())
   7909                 elif is_AlgebraicField(L):
-> 7910                     rts = complex_roots(self, retval='algebraic')
        global rts = undefined
        global complex_roots = undefined
        global self = undefined
        global retval = undefined
   7911                 else:
   7912                     rts = complex_roots(self, retval='algebraic_real')
   7913
   7914                 if multiplicities:
   7915                     return rts
   7916                 else:
   7917                     return [rt for (rt, mult) in rts]
   7918
   7919             if output_fp and output_complex and not input_gaussian:
   7920                 # If we want the complex roots, and the input is not
   7921                 # floating point, we convert to a real polynomial
   7922                 # (except when the input coefficients are Gaussian rationals).
   7923                 if is_ComplexDoubleField(L):
   7924                     real_field = RDF
   7925                 else:

/usr/lib/python3/dist-packages/sage/rings/polynomial/complex_roots.py 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 0x7f41bfd829a0>
        global multiplicities = 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/python3/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:61454)()
   7801                     ext_rts1 = numpy.roots(numpy_array)
   7802                     rts = []
   7803                     for rt in ext_rts1:
   7804                         rts.append(CDF(rt))
   7805                     rts.sort()
   7806                     ext_rts = rts
   7807                 except (ValueError, LinAlgError):
   7808                     if algorithm == 'either':
   7809                         algorithm = 'pari'
   7810                     else:
   7811                         raise
   7812
   7813             if algorithm == 'pari':
   7814                 if not input_arbprec:
   7815                     self = self.change_ring(CC if input_complex else RR)
-> 7816                 ext_rts = self.__pari__().polroots(precision=L.prec())
        global ext_rts = undefined
        global self.__pari__.polroots = undefined
        global precision = undefined
        global L.prec = undefined
   7817
   7818             if output_complex:
   7819                 rts = sort_complex_numbers_for_display([L(root) for root in ext_rts])
   7820             else:
   7821                 rts = sorted([L(root.real()) for root in ext_rts if root.imag() == 0])
   7822
   7823             rts_mult = []
   7824             j = 0
   7825             while j < len(rts):
   7826                 rt = rts[j]
   7827                 mult = rts.count(rt)
   7828                 rts_mult.append((rt, mult))
   7829                 j += mult
   7830
   7831             if multiplicities:

/usr/lib/python3/dist-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.__pari__ (build/cythonized/sage/rings/polynomial/polynomial_element.c:49914)()
   6098             sage: R.<x> = S['x']
   6099             sage: pari(x^2 + 9*x)
   6100             x^2 + 2*x
   6101             sage: pari(a*x + 9*b*x^3)
   6102             2*b*x^3 + a*x
   6103
   6104         ::
   6105
   6106             sage: S.<a> = Integers(8)['a']
   6107             sage: R.<x> = S['x']
   6108             sage: pari(x^2 + 2*x)
   6109             Mod(1, 8)*x^2 + Mod(2, 8)*x
   6110             sage: pari(a*x + 10*x^3)
   6111             Mod(2, 8)*x^3 + Mod(1, 8)*a*x
   6112         """
-> 6113         return self._pari_with_name(self._parent.variable_name())
        global self._pari_with_name = undefined
        global self._parent.variable_name = undefined
   6114
   6115     def _pari_or_constant(self, name=None):
   6116         r"""
   6117         Convert ``self`` to PARI.  This behaves identical to :meth:`__pari__`
   6118         or :meth:`_pari_with_name` except for constant polynomials:
   6119         then the constant is returned instead of a constant polynomial.
   6120
   6121         INPUT:
   6122
   6123         - ``name`` -- (default: None) Variable name.  If not given, use
   6124           ``self.parent().variable_name()``.  This argument is irrelevant
   6125           for constant polynomials.
   6126
   6127         EXAMPLES::
   6128

/usr/lib/python3/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:50319)()
   6151     def _pari_with_name(self, name='x'):
   6152         r"""
   6153         Return polynomial as a PARI object with topmost variable
   6154         ``name``.  By default, use 'x' for the variable name.
   6155
   6156         For internal use only.
   6157
   6158         EXAMPLES::
   6159
   6160             sage: R.<a> = PolynomialRing(ZZ)
   6161             sage: (2*a^2 + a)._pari_with_name()
   6162             2*x^2 + x
   6163             sage: (2*a^2 + a)._pari_with_name('y')
   6164             2*y^2 + y
   6165         """
-> 6166         vals = [x.__pari__() for x in self.list()]
        global vals = undefined
        global x.__pari__ = undefined
        global x = undefined
        global self.list = undefined
   6167         return pari(vals).Polrev(name)
   6168
   6169     def _pari_init_(self):
   6170         return repr(self.__pari__())
   6171
   6172     def _magma_init_(self, magma):
   6173         """
   6174         Return a string that evaluates in Magma to this polynomial.
   6175
   6176         EXAMPLES::
   6177
   6178             sage: magma = Magma()  # new session
   6179             sage: R.<y> = ZZ[]
   6180             sage: f = y^3 - 17*y + 5
   6181             sage: f._magma_init_(magma)        # optional - magma

/usr/lib/python3/dist-packages/sage/rings/complex_number.pyx in sage.rings.complex_number.ComplexNumber.__pari__ (build/cythonized/sage/rings/complex_number.c:7535)()
    634             <type 'cypari2.gen.Gen'>
    635             sage: a.__pari__()
    636             2.00000000000000 + 1.00000000000000*I
    637             sage: type(a.__pari__())
    638             <type 'cypari2.gen.Gen'>
    639             sage: a = CC(pi)
    640             sage: pari(a)
    641             3.14159265358979
    642             sage: pari(a).type()
    643             't_REAL'
    644             sage: a = CC(-2).sqrt()
    645             sage: pari(a)
    646             1.41421356237310*I
    647         """
    648         if self.is_real():
--> 649             return self.real().__pari__()
        global self.real.__pari__ = undefined
    650         return sage.libs.pari.all.pari.complex(self.real() or 0, self.imag())
    651
    652     def __mpc__(self):
    653         """
    654         Convert Sage ``ComplexNumber`` to gmpy2 ``mpc``.
    655
    656         EXAMPLES::
    657
    658             sage: c = ComplexNumber(2,1)
    659             sage: c.__mpc__()
    660             mpc('2.0+1.0j')
    661             sage: from gmpy2 import mpc
    662             sage: mpc(c)
    663             mpc('2.0+1.0j')
    664             sage: CF = ComplexField(134)

/usr/lib/python3/dist-packages/sage/rings/real_mpfr.pyx in sage.rings.real_mpfr.RealNumber.__pari__ (build/cythonized/sage/rings/real_mpfr.c:22906)()
   3280         cdef int prec
   3281         prec = (<RealField_class>self._parent).__prec
   3282
   3283         # We round up the precision to the nearest multiple of wordsize.
   3284         cdef int rounded_prec
   3285         rounded_prec = (self.prec() + wordsize - 1) & ~(wordsize - 1)
   3286
   3287         # Yes, assigning to self works fine, even in Cython.
   3288         if rounded_prec > prec:
   3289             self = RealField(rounded_prec)(self)
   3290
   3291         cdef mpz_t mantissa
   3292         cdef mp_exp_t exponent
   3293         cdef GEN pari_float
   3294
-> 3295         sig_on()
        global sig_on = undefined
   3296         if mpfr_zero_p(self.value):
   3297             pari_float = real_0_bit(-rounded_prec)
   3298         else:
   3299             # Now we can extract the mantissa, and it will be normalized
   3300             # (the most significant bit of the most significant word will be 1).
   3301             mpz_init(mantissa)
   3302             exponent = mpfr_get_z_exp(mantissa, self.value)
   3303
   3304             # Create a PARI REAL
   3305             pari_float = cgetr(2 + rounded_prec / wordsize)
   3306             pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value))
   3307             mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa)
   3308             mpz_clear(mantissa)
   3309
   3310         return new_gen(pari_float)

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