Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: The packaged version of Sagemath crashes on startup after giac was upgraded to 1.6.0.25-1.fc33. Running a dnf downgrade giac seems to solve the issue as Sagemath now opens and seems to be operating normally. Version-Release number of selected component (if applicable): sagemath.x86_64 9.1-4.fc33 giac.x86_64 1.6.0.25-1.fc33 How reproducible: Easily reproducible when all packages are up to date Steps to Reproduce: 1. Upgrade all Sagemath related packages to their latest version. 2. Run the sage command in the terminal 3. It crashes Actual results: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.1, Release Date: 2020-05-20 │ │ Using Python 3.9.0. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ --------------------------------------------------------------------------- --------------------------------------------------------------------------- SystemError Python 3.9.0: /usr/bin/python3 Sat Nov 28 15:35:53 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/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__complex__ (build/cythonized/sage/rings/real_lazy.c:10039)() 820 try: --> 821 return self.eval(complex) global self.eval = undefined global complex = undefined 822 except Exception: /usr/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18256)() 1645 if self._prec < 53: -> 1646 self.eval(self.parent().interval_field(64)) # up the prec global self.eval = undefined global self.parent.interval_field = undefined 1647 elif R.is_exact() or self._prec < R.prec(): /usr/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18407)() 1671 from sage.rings.qqbar import AA, QQbar -> 1672 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 1673 best_root = roots[0][0] /usr/lib64/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:63149)() 7845 elif is_AlgebraicField(L): -> 7846 rts = complex_roots(self, retval='algebraic') global rts = undefined global complex_roots = undefined global self = undefined global retval = undefined 7847 else: /usr/lib64/python3.9/site-packages/sage/rings/polynomial/complex_roots.py in complex_roots(p=x^2 + 1, skip_squarefree=False, retval='algebraic', min_prec=0) 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 0x7fd737c2f6a0> global multiplicities = undefined 259 # Make sure the number of roots we found is the degree. If /usr/lib64/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:60658)() 7756 if output_complex: -> 7757 rts = sort_complex_numbers_for_display([L(root) for root in ext_rts]) global rts = undefined global sort_complex_numbers_for_display = <function sort_complex_numbers_for_display at 0x7fd9610153a0> global L = undefined global root = undefined global ext_rts = undefined 7758 else: /usr/lib64/python3.9/site-packages/sage/rings/complex_field.py in __call__(self=Complex Field with 53 bits of precision, x=0.E-19 - 1.00000000000000*I, im=None) 386 x = x, im --> 387 return Parent.__call__(self, x) global Parent.__call__ = <slot wrapper '__call__' of 'sage.structure.parent.Parent' objects> self = Complex Field with 53 bits of precision x = 0.E-19 - 1.00000000000000*I 388 /usr/lib64/python3.9/site-packages/sage/structure/parent.pyx in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9308)() 899 if no_extra_args: --> 900 return mor._call_(x) global mor._call_ = undefined global x = undefined 901 else: /usr/lib64/python3.9/site-packages/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4595)() 160 print(type(C._element_constructor), C._element_constructor) --> 161 raise 162 /usr/lib64/python3.9/site-packages/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4487)() 155 try: --> 156 return C._element_constructor(x) global C._element_constructor = undefined global x = undefined 157 except Exception: /usr/lib64/python3.9/site-packages/sage/rings/complex_field.py in _element_constructor_(self=Complex Field with 53 bits of precision, x=0.E-19 - 1.00000000000000*I) 421 try: --> 422 return self(x.sage()) self = Complex Field with 53 bits of precision x.sage = <bound method Gen.sage of 0.E-19 - 1.00000000000000*I> 423 except (AttributeError, TypeError): cypari2/gen.pyx in cypari2.gen.Gen.sage() /usr/lib64/python3.9/site-packages/sage/libs/pari/convert_sage.pyx in sage.libs.pari.convert_sage.gen_to_sage (build/cythonized/sage/libs/pari/convert_sage.c:4371)() 31 ---> 32 cpdef gen_to_sage(Gen z, locals=None): global cpdef = undefined global gen_to_sage = <built-in function gen_to_sage> global Gen = undefined global z = undefined global locals = undefined 33 """ /usr/lib64/python3.9/site-packages/sage/libs/pari/convert_sage.pyx in sage.libs.pari.convert_sage.gen_to_sage (build/cythonized/sage/libs/pari/convert_sage.c:3155)() 246 elif t == t_COMPLEX: --> 247 real = z.real() global real = undefined global z.real = undefined 248 imag = z.imag() cypari2/auto_gen.pxi in cypari2.gen.Gen_base.real() cypari2/stack.pyx in cypari2.stack.new_gen() cypari2/stack.pyx in cypari2.stack.new_gen_noclear() SystemError: new_gen() argument not on PARI stack, not on PARI heap and not a universal constant During handling of the above exception, another exception occurred: --------------------------------------------------------------------------- SystemError Python 3.9.0: /usr/bin/python3 Sat Nov 28 15:35:53 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/lib64/sagemath/local/bin/sage-ipython in <module>() 1 #!/usr/bin/python3 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 0x7fd96aa52df0>> 16 app.start() <decorator-gen-110> in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None) /usr/lib/python3.9/site-packages/traitlets/config/application.py in catch_config_error(method=<function TerminalIPythonApp.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 TerminalIPythonApp.initialize at 0x7fd9698e6ca0> app = <sage.repl.interpreter.SageTerminalApp object at 0x7fd96aa52df0> 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/lib64/sagemath/site-packages/IPython/terminal/ipapp.py 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 0x7fd96aa52df0>> 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/lib64/python3.9/site-packages/sage/repl/interpreter.py in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>) 772 self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions 773 774 # Load the %lprun extension if available 775 try: 776 import line_profiler 777 except ImportError: 778 pass 779 else: 780 self.extensions.append('line_profiler') 781 782 if self.shell.has_sage_extensions: 783 self.extensions.remove(SAGE_EXTENSION) 784 785 # load sage extension here to get a crash if 786 # something is wrong with the sage library --> 787 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 0x7fd963bfd520>> global SAGE_EXTENSION = 'sage' 788 789 /usr/lib64/sagemath/site-packages/IPython/core/extensions.py 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 0x7fd963bfd520>> mod = <module 'sage' from '/usr/lib64/python3.9/site-packages/sage/__init__.py'> 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/lib64/sagemath/site-packages/IPython/core/extensions.py in _call_load_ipython_extension(self=<IPython.core.extensions.ExtensionManager object>, mod=<module 'sage' from '/usr/lib64/python3.9/site-packages/sage/__init__.py'>) 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 0x7fd96aa4d940> self.shell = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fd969885df0> 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/lib64/python3.9/site-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 # Make sure that the correct zlib library is loaded. This is needed 8 # to prevent the system zlib to be loaded instead of the Sage one. 9 # See https://trac.sagemath.org/ticket/23122 10 import zlib 11 12 # IPython calls this when starting up 13 def load_ipython_extension(*args): 14 import sage.repl.ipython_extension ---> 15 sage.repl.ipython_extension.load_ipython_extension(*args) sage.repl.ipython_extension.load_ipython_extension = <function load_ipython_extension at 0x7fd963a91d30> args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fd969885df0>,) 16 17 18 # Monkey-patch inspect.isfunction() to support Cython functions. 19 def isfunction(obj): 20 """ 21 Check whether something is a function. 22 23 We assume that anything which has a genuine ``__code__`` 24 attribute (not using ``__getattr__`` overrides) is a function. 25 This is meant to support Cython functions. 26 27 EXAMPLES:: 28 29 sage: from inspect import isfunction 30 sage: def f(): pass 31 sage: isfunction(f) /usr/lib64/python3.9/site-packages/sage/repl/ipython_extension.py in wrapper(*args=(<sage.repl.interpreter.SageTerminalInteractiveShell object>,), **kwargs={}) 549 ....: if work: 550 ....: return 'foo worked' 551 ....: raise RuntimeError("foo didn't work") 552 sage: foo(False) 553 Traceback (most recent call last): 554 ... 555 RuntimeError: foo didn't work 556 sage: foo(True) 557 'foo worked' 558 sage: foo(False) 559 sage: foo(True) 560 """ 561 @wraps(func) 562 def wrapper(*args, **kwargs): 563 if not wrapper.has_run: --> 564 result = func(*args, **kwargs) result = undefined global func = undefined args = (<sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fd969885df0>,) kwargs = {} 565 wrapper.has_run = True 566 return result 567 wrapper.has_run = False 568 return wrapper 569 570 571 @run_once 572 def load_ipython_extension(ip): 573 """ 574 Load the extension in IPython. 575 """ 576 # this modifies ip 577 SageCustomizations(shell=ip) /usr/lib64/python3.9/site-packages/sage/repl/ipython_extension.py in load_ipython_extension(ip=<sage.repl.interpreter.SageTerminalInteractiveShell object>) 562 def wrapper(*args, **kwargs): 563 if not wrapper.has_run: 564 result = func(*args, **kwargs) 565 wrapper.has_run = True 566 return result 567 wrapper.has_run = False 568 return wrapper 569 570 571 @run_once 572 def load_ipython_extension(ip): 573 """ 574 Load the extension in IPython. 575 """ 576 # this modifies ip --> 577 SageCustomizations(shell=ip) global SageCustomizations = <class 'sage.repl.ipython_extension.SageCustomizations'> global shell = undefined ip = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fd969885df0> /usr/lib64/python3.9/site-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/lib64/python3.9/site-packages/sage/all.py in <module>() 119 from sage.misc.all import * # takes a while 120 from sage.typeset.all import * 121 from sage.repl.all import * 122 123 from sage.misc.sh import sh 124 125 from sage.libs.all import * 126 from sage.data_structures.all import * 127 from sage.doctest.all import * 128 129 from sage.structure.all import * 130 from sage.rings.all import * 131 from sage.arith.all import * 132 from sage.matrix.all import * 133 --> 134 from sage.symbolic.all import * global sage.symbolic.all = undefined 135 from sage.modules.all import * 136 from sage.monoids.all import * 137 from sage.algebras.all import * 138 from sage.modular.all import * 139 from sage.sat.all import * 140 from sage.schemes.all import * 141 from sage.graphs.all import * 142 from sage.groups.all import * 143 from sage.arith.power import generic_power as power 144 from sage.databases.all import * 145 from sage.categories.all import * 146 from sage.sets.all import * 147 from sage.probability.all import * 148 from sage.interfaces.all import * 149 /usr/lib64/python3.9/site-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/lib64/python3.9/site-packages/sage/libs/pynac/pynac.pyx in init sage.libs.pynac.pynac (build/cythonized/sage/libs/pynac/pynac.cpp:32100)() 2523 py_funcs.ex_to_pyExpression = &ex_to_pyExpression 2524 py_funcs.subs_args_to_PyTuple = &subs_args_to_PyTuple 2525 py_funcs.py_print_function = &py_print_function 2526 py_funcs.py_latex_function = &py_latex_function 2527 py_funcs.py_get_ginac_serial = &py_get_ginac_serial 2528 py_funcs.py_get_sfunction_from_serial = &py_get_sfunction_from_serial 2529 py_funcs.py_get_serial_from_sfunction = &py_get_serial_from_sfunction 2530 py_funcs.py_get_serial_for_new_sfunction = &py_get_serial_for_new_sfunction 2531 2532 py_funcs.py_get_constant = &py_get_constant 2533 py_funcs.py_print_fderivative = &py_print_fderivative 2534 py_funcs.py_latex_fderivative = &py_latex_fderivative 2535 py_funcs.paramset_to_PyTuple = ¶mset_to_PyTuple 2536 2537 init_function_table() -> 2538 init_pynac_I() global init_pynac_I = <built-in function init_pynac_I> 2539 2540 set_ginac_fn_serial() /usr/lib64/python3.9/site-packages/sage/libs/pynac/pynac.pyx in sage.libs.pynac.pynac.init_pynac_I (build/cythonized/sage/libs/pynac/pynac.cpp:27274)() 2425 <type 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'> 2426 2427 Check that :trac:`10064` is fixed:: 2428 2429 sage: y = I*I*x / x # so y is the expression -1 2430 sage: y.is_positive() 2431 False 2432 sage: z = -x / x 2433 sage: z.is_positive() 2434 False 2435 sage: bool(z == y) 2436 True 2437 """ 2438 global pynac_I, I 2439 from sage.rings.number_field.number_field import QuadraticField -> 2440 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 2441 pynac_I = K.gen() 2442 ginac_pyinit_I(pynac_I) 2443 I = new_Expression_from_GEx(ring.SR, g_I) 2444 2445 2446 def init_function_table(): 2447 """ 2448 Initializes the function pointer table in Pynac. This must be 2449 called before Pynac is used; otherwise, there will be segfaults. 2450 """ 2451 2452 py_funcs.py_gcd = &py_gcd 2453 py_funcs.py_lcm = &py_lcm 2454 py_funcs.py_real = &py_real 2455 py_funcs.py_imag = &py_imag /usr/lib64/python3.9/site-packages/sage/rings/number_field/number_field.py in QuadraticField(D=-1, name='I', check=True, embedding=1.00000000000000*I, latex_name='i', **args={}) 941 D = QQ(D) 942 if check: 943 if D.is_square(): 944 raise ValueError("D must not be a perfect square.") 945 R = QQ['x'] 946 f = R([-D, 0, 1]) 947 if embedding is True: 948 if D > 0: 949 embedding = RLF(D).sqrt() 950 else: 951 embedding = CLF(D).sqrt() 952 elif embedding is False: 953 embedding = None 954 if latex_name == 'sqrt': 955 latex_name = r'\sqrt{%s}' % D --> 956 return NumberField(f, name, check=False, embedding=embedding, latex_name=latex_name, **args) global NumberField = <function NumberField at 0x7fd7e1513550> f = x^2 + 1 name = 'I' check = True embedding = 1.00000000000000*I latex_name = 'i' args = {} 957 958 def is_AbsoluteNumberField(x): 959 """ 960 Return True if x is an absolute number field. 961 962 EXAMPLES:: 963 964 sage: from sage.rings.number_field.number_field import is_AbsoluteNumberField 965 sage: is_AbsoluteNumberField(NumberField(x^2+1,'a')) 966 True 967 sage: is_AbsoluteNumberField(NumberField([x^3 + 17, x^2+1],'a')) 968 False 969 970 The rationals are a number field, but they're not of the absolute 971 number field class. /usr/lib64/python3.9/site-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, **kwds={}) 536 Defn: a |--> [0 1 0 0] 537 [0 0 1 0] 538 [0 0 0 1] 539 [2 0 0 0] 540 """ 541 if names is not None: 542 name = names 543 for key, val in kwds.items(): 544 if key not in ['implementation', 'prec']: 545 raise TypeError("NumberField() got an unexpected keyword argument '%s'"%key) 546 if not (val is None or isinstance(val, list) and all(c is None for c in val)): 547 raise NotImplementedError("Number field with prescribed %s is not implemented"%key) 548 if isinstance(polynomial, (list,tuple)): 549 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) 550 --> 551 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 0x7fd7e0f9d0e0> 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 552 553 class NumberFieldFactory(UniqueFactory): 554 r""" 555 Factory for number fields. 556 557 This should usually not be called directly, use :meth:`NumberField` 558 instead. 559 560 INPUT: 561 562 - ``polynomial`` - a polynomial over `\QQ` or a number field. 563 - ``name`` - a string (default: ``'a'``), the name of the generator 564 - ``check`` - a boolean (default: ``True``); do type checking and 565 irreducibility checking. 566 - ``embedding`` - ``None`` or an element, the images of the generator /usr/lib64/python3.9/site-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:2264)() 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/lib64/python3.9/site-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.get_object (build/cythonized/sage/structure/factory.c:2471)() 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/lib64/python3.9/site-packages/sage/misc/weak_dict.pyx in sage.misc.weak_dict.WeakValueDictionary.__getitem__ (build/cythonized/sage/misc/weak_dict.c:3689)() 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/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__hash__ (build/cythonized/sage/rings/real_lazy.c:9260)() 692 except TypeError: 693 pass 694 left, right = self.approx(), other.approx() 695 return richcmp(left.endpoints(), right.endpoints(), op) 696 697 def __hash__(self): 698 """ 699 Return the hash value of ``self``. 700 701 EXAMPLES:: 702 703 sage: a = RLF(3) 704 sage: hash(a) 705 3 706 """ --> 707 return hash(complex(self)) global hash = undefined global complex = undefined global self = undefined 708 709 cdef LazyFieldElement _new_wrapper(self, value): 710 cdef LazyWrapper e = <LazyWrapper>LazyWrapper.__new__(LazyWrapper) 711 e._parent = self._parent 712 e._value = value 713 return e 714 715 cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op): 716 cdef LazyBinop e = <LazyBinop>LazyBinop.__new__(LazyBinop) 717 e._parent = self._parent 718 e._left = left 719 e._right = right 720 e._op = op 721 return e 722 /usr/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyFieldElement.__complex__ (build/cythonized/sage/rings/real_lazy.c:10117)() 809 _real_mpfi_ = _complex_mpfi_ =_mpfr_ = _complex_mpfr_field_ = _generic_ 810 811 def __complex__(self): 812 """ 813 Return ``self`` as a complex. 814 815 EXAMPLES:: 816 817 sage: complex(CLF(-1)^(1/4)) 818 (0.707106781186547...+0.707106781186547...j) 819 """ 820 try: 821 return self.eval(complex) 822 except Exception: 823 from .complex_field import ComplexField --> 824 return complex(self.eval(ComplexField(53))) global complex = undefined global self.eval = undefined global ComplexField = undefined 825 826 cpdef eval(self, R): 827 """ 828 Abstract method for converting ``self`` into an element of ``R``. 829 830 EXAMPLES:: 831 832 sage: a = RLF(12) 833 sage: a.eval(ZZ) 834 12 835 """ 836 raise NotImplementedError("Subclasses must override this method.") 837 838 cpdef int depth(self): 839 """ /usr/lib64/python3.9/site-packages/sage/rings/real_lazy.pyx in sage.rings.real_lazy.LazyAlgebraic.eval (build/cythonized/sage/rings/real_lazy.c:18407)() 1657 # else: 1658 # z = (-b + R(self._quadratic_disc).sqrt()) / (2*a) 1659 # if z.parent() is not R: 1660 # z = R(z) 1661 # self._root_approx = z 1662 # from sage.rings.complex_interval_field import is_IntervalField 1663 # if is_IntervalField(R): 1664 # self._root_approx = (self._root_approx.upper() + self._root_approx.lower()) / 2 1665 # self._prec = R.prec() 1666 # return R(self._root_approx) 1667 if self._root is None: 1668 # This could be done much more efficiently with Newton iteration, 1669 # but will require some care to make sure we get the right root, and 1670 # to the correct precision. 1671 from sage.rings.qqbar import AA, QQbar -> 1672 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 1673 best_root = roots[0][0] 1674 min_dist = abs(self._root_approx - best_root) 1675 for r, e in roots[1:]: 1676 dist = abs(self._root_approx - r) 1677 if dist < min_dist: 1678 best_root = r 1679 min_dist = dist 1680 self._root = best_root 1681 if self._root is not None: 1682 return R(self._root) 1683 1684 def __float__(self): 1685 """ 1686 TESTS:: 1687 /usr/lib64/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:63149)() 7831 7832 if multiplicities: 7833 return rts 7834 else: 7835 return [rt for (rt, mult) in rts] 7836 7837 if (is_IntegerRing(K) or is_RationalField(K) 7838 or is_AlgebraicField_common(K) or input_gaussian) and \ 7839 (is_ComplexIntervalField(L) or is_AlgebraicField_common(L)): 7840 7841 from sage.rings.polynomial.complex_roots import complex_roots 7842 7843 if is_ComplexIntervalField(L): 7844 rts = complex_roots(self, min_prec=L.prec()) 7845 elif is_AlgebraicField(L): -> 7846 rts = complex_roots(self, retval='algebraic') global rts = undefined global complex_roots = undefined global self = undefined global retval = undefined 7847 else: 7848 rts = complex_roots(self, retval='algebraic_real') 7849 7850 if multiplicities: 7851 return rts 7852 else: 7853 return [rt for (rt, mult) in rts] 7854 7855 if output_fp and output_complex and not input_gaussian: 7856 # If we want the complex roots, and the input is not 7857 # floating point, we convert to a real polynomial 7858 # (except when the input coefficients are Gaussian rationals). 7859 if is_ComplexDoubleField(L): 7860 real_field = RDF 7861 else: /usr/lib64/python3.9/site-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 0x7fd737c2fe80> 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/lib64/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:60538)() 7739 ext_rts1 = numpy.roots(numpy_array) 7740 rts = [] 7741 for rt in ext_rts1: 7742 rts.append(CDF(rt)) 7743 rts.sort() 7744 ext_rts = rts 7745 except (ValueError, LinAlgError): 7746 if algorithm == 'either': 7747 algorithm = 'pari' 7748 else: 7749 raise 7750 7751 if algorithm == 'pari': 7752 if not input_arbprec: 7753 self = self.change_ring(CC if input_complex else RR) -> 7754 ext_rts = self.__pari__().polroots(precision=L.prec()) global ext_rts = undefined global self.__pari__.polroots = undefined global precision = undefined global L.prec = undefined 7755 7756 if output_complex: 7757 rts = sort_complex_numbers_for_display([L(root) for root in ext_rts]) 7758 else: 7759 rts = sorted([L(root.real()) for root in ext_rts if root.imag() == 0]) 7760 7761 rts_mult = [] 7762 j = 0 7763 while j < len(rts): 7764 rt = rts[j] 7765 mult = rts.count(rt) 7766 rts_mult.append((rt, mult)) 7767 j += mult 7768 7769 if multiplicities: /usr/lib64/python3.9/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.__pari__ (build/cythonized/sage/rings/polynomial/polynomial_element.c:50080)() 6116 sage: R.<x> = S['x'] 6117 sage: pari(x^2 + 9*x) 6118 x^2 + 2*x 6119 sage: pari(a*x + 9*b*x^3) 6120 2*b*x^3 + a*x 6121 6122 :: 6123 6124 sage: S.<a> = Integers(8)['a'] 6125 sage: R.<x> = S['x'] 6126 sage: pari(x^2 + 2*x) 6127 Mod(1, 8)*x^2 + Mod(2, 8)*x 6128 sage: pari(a*x + 10*x^3) 6129 Mod(2, 8)*x^3 + Mod(1, 8)*a*x 6130 """ -> 6131 return self._pari_with_name(self._parent.variable_name()) global self._pari_with_name = undefined global self._parent.variable_name = undefined 6132 6133 def _pari_or_constant(self, name=None): 6134 r""" 6135 Convert ``self`` to PARI. This behaves identical to :meth:`__pari__` 6136 or :meth:`_pari_with_name` except for constant polynomials: 6137 then the constant is returned instead of a constant polynomial. 6138 6139 INPUT: 6140 6141 - ``name`` -- (default: None) Variable name. If not given, use 6142 ``self.parent().variable_name()``. This argument is irrelevant 6143 for constant polynomials. 6144 6145 EXAMPLES:: 6146 /usr/lib64/python3.9/site-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:50485)() 6169 def _pari_with_name(self, name='x'): 6170 r""" 6171 Return polynomial as a PARI object with topmost variable 6172 ``name``. By default, use 'x' for the variable name. 6173 6174 For internal use only. 6175 6176 EXAMPLES:: 6177 6178 sage: R.<a> = PolynomialRing(ZZ) 6179 sage: (2*a^2 + a)._pari_with_name() 6180 2*x^2 + x 6181 sage: (2*a^2 + a)._pari_with_name('y') 6182 2*y^2 + y 6183 """ -> 6184 vals = [x.__pari__() for x in self.list()] global vals = undefined global x.__pari__ = undefined global x = undefined global self.list = undefined 6185 return pari(vals).Polrev(name) 6186 6187 def _pari_init_(self): 6188 return repr(self.__pari__()) 6189 6190 def _magma_init_(self, magma): 6191 """ 6192 Return a string that evaluates in Magma to this polynomial. 6193 6194 EXAMPLES:: 6195 6196 sage: magma = Magma() # new session 6197 sage: R.<y> = ZZ[] 6198 sage: f = y^3 - 17*y + 5 6199 sage: f._magma_init_(magma) # optional - magma /usr/lib64/python3.9/site-packages/sage/rings/complex_number.pyx in sage.rings.complex_number.ComplexNumber.__pari__ (build/cythonized/sage/rings/complex_number.c:7183)() 575 <type 'cypari2.gen.Gen'> 576 sage: a.__pari__() 577 2.00000000000000 + 1.00000000000000*I 578 sage: type(a.__pari__()) 579 <type 'cypari2.gen.Gen'> 580 sage: a = CC(pi) 581 sage: pari(a) 582 3.14159265358979 583 sage: pari(a).type() 584 't_REAL' 585 sage: a = CC(-2).sqrt() 586 sage: pari(a) 587 1.41421356237310*I 588 """ 589 if self.is_real(): --> 590 return self.real().__pari__() global self.real.__pari__ = undefined 591 return sage.libs.pari.all.pari.complex(self.real() or 0, self.imag()) 592 593 def __mpc__(self): 594 """ 595 Convert Sage ``ComplexNumber`` to gmpy2 ``mpc``. 596 597 EXAMPLES:: 598 599 sage: c = ComplexNumber(2,1) 600 sage: c.__mpc__() 601 mpc('2.0+1.0j') 602 sage: from gmpy2 import mpc 603 sage: mpc(c) 604 mpc('2.0+1.0j') 605 sage: CF = ComplexField(134) /usr/lib64/python3.9/site-packages/sage/rings/real_mpfr.pyx in sage.rings.real_mpfr.RealNumber.__pari__ (build/cythonized/sage/rings/real_mpfr.c:22899)() 3265 sig_on() 3266 if mpfr_zero_p(self.value): 3267 pari_float = real_0_bit(-rounded_prec) 3268 else: 3269 # Now we can extract the mantissa, and it will be normalized 3270 # (the most significant bit of the most significant word will be 1). 3271 mpz_init(mantissa) 3272 exponent = mpfr_get_z_exp(mantissa, self.value) 3273 3274 # Create a PARI REAL 3275 pari_float = cgetr(2 + rounded_prec / wordsize) 3276 pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value)) 3277 mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa) 3278 mpz_clear(mantissa) 3279 -> 3280 return new_gen(pari_float) global new_gen = undefined global pari_float = undefined 3281 3282 def _mpmath_(self, prec=None, rounding=None): 3283 """ 3284 Return an mpmath version of this :class:`RealNumber`. 3285 3286 .. NOTE:: 3287 3288 Currently the rounding mode is ignored. 3289 3290 EXAMPLES:: 3291 3292 sage: RR(-1.5)._mpmath_() 3293 mpf('-1.5') 3294 """ 3295 if prec is not None: cypari2/stack.pyx in cypari2.stack.new_gen() cypari2/stack.pyx in cypari2.stack.new_gen_noclear() SystemError: new_gen() argument not on PARI stack, not on PARI heap and not a universal constant ********************************************************************** 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/jorge/.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 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 < /home/jorge/.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): Expected results: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.1, Release Date: 2020-05-20 │ │ Using Python 3.9.0. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: Additional info: when running dnf downgrade giac, giac-1.6.0.7-4.fc33.x86_64 is installed in place of the newer version. Also this is the stable, workstation edition of Fedora GNOME.
Probable duplicate of bug 1895038. Can you please try the update in bug 1895038 comment 18 and see if that fixes your problem?
*** This bug has been marked as a duplicate of bug 1895038 ***