> On 5/08/2017, at 23:22, Frédéric Chapoton <fchapot...@gmail.com> wrote:
> 
> /home/chapoton/sage3/local/lib/libpython2.7.so.1.0(PyInt_FromLong+0x53)[0x7f950a139ef3]
> /home/chapoton/sage3/local/lib/libpynac.so.13(+0x88196)[0x7f950a559196]
> 

Pynac still being built and link to python 2.7 may be your cause of trouble.

In sage-on-gentoo I have managed to build everything python3.6 (including 
pynac).
I also crash on startup but not with a segfault:
fbissey@moonloop ~ $ EPYTHON=python3.6 sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.1.beta0, Release Date: 2017-07-29               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

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

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/fbissey/.ipython/Sage_crash_report.txt’

Crash log in attachment.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
***************************************************************************

IPython post-mortem report

{'commit_hash': '5a894b9',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/lib64/python3.6/site-packages/IPython',
 'ipython_version': '5.3.0',
 'os_name': 'posix',
 'platform': 
'Linux-4.11.5-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1230_v3_@_3.30GHz-with-gentoo-2.3',
 'sys_executable': '/usr/bin/python3.6',
 'sys_platform': 'linux',
 'sys_version': '3.6.1 (default, May 20 2017, 20:15:55) \n[GCC 5.4.0]'}

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



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

Crash traceback:

---------------------------------------------------------------------------
---------------------------------------------------------------------------
TypeError                                  Python 3.6.1: /usr/bin/python3.6
                                                   Sat Aug  5 23:29:59 2017
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/lib/python-exec/python3.6/sage-ipython in <module>()
      1 #!/usr/bin/env python3.6
      2 # -*- coding: utf-8 -*-
      3 """
      4 Sage IPython startup script.
      5 """
      6 
      7 from sage.repl.interpreter import SageTerminalApp
      8 
      9 app = SageTerminalApp.instance()
---> 10 app.initialize()
        global app.initialize = <bound method TerminalIPythonApp.initialize of 
<sage.repl.interpreter.SageTerminalApp object at 0x7f3d64be9390>>
     11 app.start()

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

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

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

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

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

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

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

/usr/lib64/python3.6/site-packages/sage/all.py in <module>()
     72 
     73 # Add SAGE_SRC at the end of sys.path to enable Cython tracebacks
     74 # (which use paths relative to SAGE_SRC)
     75 sys.path.append(SAGE_SRC)
     76 
     77 
     78 ###################################################################
     79 
     80 # This import also setups the interrupt handler
     81 from cysignals.signals import (AlarmInterrupt, SignalError,
     82         sig_on_reset as sig_on_count)
     83 
     84 from time                import sleep
     85 
     86 import sage.misc.lazy_import
---> 87 from sage.misc.all       import *         # takes a while
        global sage.misc.all = undefined
     88 from sage.typeset.all    import *
     89 from sage.repl.all       import *
     90 
     91 from sage.misc.sh import sh
     92 
     93 from sage.libs.all       import *
     94 from sage.data_structures.all import *
     95 from sage.doctest.all    import *
     96 
     97 from sage.structure.all  import *
     98 from sage.rings.all      import *
     99 from sage.arith.all      import *
    100 from sage.matrix.all     import *
    101 
    102 from sage.symbolic.all   import *

/usr/lib64/python3.6/site-packages/sage/misc/all.py in <module>()
     63 
     64 from .defaults import (set_default_variable_name,
     65                         series_precision, set_series_precision)
     66 
     67 from .sage_eval import sage_eval, sageobj
     68 
     69 from .sage_input import sage_input
     70 
     71 lazy_import("sage.misc.cython", ["cython_lambda", 
"cython_create_local_so"]) 
     72 lazy_import("sage.misc.cython_c", "cython_compile", "cython")
     73 
     74 from .persist import save, load, dumps, loads, db, db_save
     75 
     76 from .func_persist import func_persist
     77 
---> 78 from .functional import (additive_order,
        global functional = undefined
        global additive_order = undefined
        global base_ring = undefined
        global base_field = undefined
        global basis = undefined
        global category = undefined
        global charpoly = undefined
        global characteristic_polynomial = undefined
        global coerce = undefined
        global cyclotomic_polynomial = undefined
        global decomposition = undefined
        global denominator = undefined
        global det = undefined
        global dimension = undefined
        global dim = undefined
        global discriminant = undefined
        global disc = undefined
        global eta = undefined
        global fcp = undefined
        global gen = undefined
        global gens = undefined
        global hecke_operator = undefined
        global image = undefined
        global integral = undefined
        global integrate = undefined
        global integral_closure = undefined
        global interval = undefined
        global xinterval = undefined
        global is_commutative = undefined
        global is_even = undefined
        global is_integrally_closed = undefined
        global is_field = undefined
        global is_odd = undefined
        global kernel = undefined
        global krull_dimension = undefined
        global lift = undefined
        global log = undefined
        global log_b = undefined
        global minimal_polynomial = undefined
        global minpoly = undefined
        global multiplicative_order = undefined
        global ngens = undefined
        global norm = undefined
        global numerator = undefined
        global numerical_approx = undefined
        global n = undefined
        global N = undefined
        global objgens = undefined
        global objgen = undefined
        global order = undefined
        global rank = undefined
        global regulator = undefined
        global round = undefined
        global quotient = undefined
        global quo = undefined
        global isqrt = undefined
        global squarefree_part = undefined
        global symbolic_sum = undefined
        global sum = undefined
        global symbolic_prod = undefined
        global product = undefined
        global transpose = undefined
     79                         base_ring,
     80                         base_field,
     81                         basis,
     82                         category,
     83                         charpoly,
     84                         characteristic_polynomial,
     85                         coerce,
     86                         cyclotomic_polynomial,
     87                         decomposition,
     88                         denominator,
     89                         det,
     90                         dimension,
     91                         dim,
     92                         discriminant,
     93                         disc,

/usr/lib64/python3.6/site-packages/sage/misc/functional.py in <module>()
     12 - David Joyner (2005-12-20): More Examples
     13 """
     14 
#*****************************************************************************
     15 #       Copyright (C) 2004 William Stein <wst...@gmail.com>
     16 #
     17 # This program is free software: you can redistribute it and/or modify
     18 # it under the terms of the GNU General Public License as published by
     19 # the Free Software Foundation, either version 2 of the License, or
     20 # (at your option) any later version.
     21 #                  http://www.gnu.org/licenses/
     22 
#*****************************************************************************
     23 from __future__ import absolute_import
     24 from six.moves import range, builtins
     25 from six import integer_types
     26 
---> 27 from sage.rings.complex_double import CDF
        global sage.rings.complex_double = undefined
        global CDF = undefined
     28 from sage.rings.real_double import RDF, RealDoubleElement
     29 from sage.rings.integer_ring import ZZ
     30 from sage.rings.integer import Integer
     31 
     32 
##############################################################################
     33 # There are many functions on elements of a ring, which mathematicians
     34 # usually write f(x), e.g., it is weird to write x.log() and natural
     35 # to write log(x).  The functions below allow for the more familiar 
syntax.
     36 
##############################################################################
     37 
     38 
     39 def additive_order(x):
     40     """
     41     Return the additive order of ``x``.
     42 

/usr/lib64/python3.6/site-packages/sage/rings/complex_double.pyx in init 
sage.rings.complex_double()
----> 1 r"""
      2 Double Precision Complex Numbers
      3 
      4 Sage supports arithmetic using double-precision complex numbers. A
      5 double-precision complex number is a complex number ``x + I*y`` with
      6 `x`, `y` 64-bit (8 byte) floating point numbers (double precision).
      7 
      8 The field :class:`ComplexDoubleField` implements the field
      9 of all double-precision complex numbers. You can refer to this
     10 field by the shorthand CDF. Elements of this field are of type
     11 :class:`ComplexDoubleElement`. If `x` and `y` are coercible to
     12 doubles, you can create a complex double element using
     13 ``ComplexDoubleElement(x,y)``. You can coerce more
     14 general objects `z` to complex doubles by typing either
     15 ``ComplexDoubleField(x)`` or ``CDF(x)``.
     16 
     17 EXAMPLES::
     18 
     19     sage: ComplexDoubleField()
     20     Complex Double Field
     21     sage: CDF
     22     Complex Double Field
     23     sage: type(CDF.0)
     24     <type 'sage.rings.complex_double.ComplexDoubleElement'>
     25     sage: ComplexDoubleElement(sqrt(2),3)
     26     1.4142135623730951 + 3.0*I
     27     sage: parent(CDF(-2))
     28     Complex Double Field
     29 
     30 ::
     31 

/usr/lib64/python3.6/site-packages/sage/rings/ring.pyx in init sage.rings.ring()
----> 1 """
      2 Rings
      3 
      4 This module provides the abstract base class :class:`Ring` from which
      5 all rings in Sage (used to) derive, as well as a selection of more
      6 specific base classes.
      7 
      8 .. WARNING::
      9 
     10     Those classes, except maybe for the lowest ones like :class:`Ring`,
     11     :class:`CommutativeRing`, :class:`Algebra` and 
:class:`CommutativeAlgebra`,
     12     are being progressively deprecated in favor of the corresponding
     13     categories. which are more flexible, in particular with respect to 
multiple
     14     inheritance.
     15 
     16 The class inheritance hierarchy is:
     17 
     18 - :class:`Ring`
     19 
     20   - :class:`Algebra`
     21   - :class:`CommutativeRing`
     22 
     23     - :class:`NoetherianRing`
     24     - :class:`CommutativeAlgebra`
     25     - :class:`IntegralDomain`
     26 
     27       - :class:`DedekindDomain`
     28       - :class:`PrincipalIdealDomain`
     29 
     30 Subclasses of :class:`PrincipalIdealDomain` are
     31 

/usr/lib64/python3.6/site-packages/sage/structure/parent_gens.pyx in init 
sage.structure.parent_gens()
----> 1 r"""
      2 Base class for old-style parent objects with generators
      3 
      4 .. NOTE::
      5 
      6    This class is being deprecated, see
      7    ``sage.structure.parent.Parent`` and
      8    ``sage.structure.category_object.CategoryObject`` for the new
      9    model.
     10 
     11 Many parent objects in Sage are equipped with generators, which are
     12 special elements of the object.  For example, the polynomial ring
     13 `\ZZ[x,y,z]` is generated by `x`, `y`, and `z`.  In Sage the `i^{th}`
     14 generator of an object ``X`` is obtained using the notation
     15 ``X.gen(i)``.  From the Sage interactive prompt, the shorthand
     16 notation ``X.i`` is also allowed.
     17 
     18 REQUIRED: A class that derives from ParentWithGens *must* define
     19 the ngens() and gen(i) methods.
     20 
     21 OPTIONAL: It is also good if they define gens() to return all gens,
     22 but this is not necessary.
     23 
     24 The ``gens`` function returns a tuple of all generators, the
     25 ``ngens`` function returns the number of generators.
     26 
     27 The ``_assign_names`` functions is for internal use only, and is
     28 called when objects are created to set the generator names.  It can
     29 only be called once.
     30 
     31 The following examples illustrate these functions in the context of

/usr/lib64/python3.6/site-packages/sage/structure/parent_base.pyx in init 
sage.structure.parent_base()
----> 1 r"""
      2 Base class for old-style parent objects with a base ring
      3 """
      4 
      5 
#*****************************************************************************
      6 #       Copyright (C) 2006 William Stein <wst...@gmail.com>
      7 #
      8 # This program is free software: you can redistribute it and/or modify
      9 # it under the terms of the GNU General Public License as published by
     10 # the Free Software Foundation, either version 2 of the License, or
     11 # (at your option) any later version.
     12 #                  http://www.gnu.org/licenses/
     13 
#*****************************************************************************
     14 
     15 from __future__ import absolute_import
     16 
     17 cimport sage.structure.parent as parent
     18 
     19 from .coerce_exceptions import CoercionException
     20 
     21 cdef inline check_old_coerce(parent.Parent p):
     22     if p._element_constructor is not None:
     23         raise RuntimeError("%s still using old coercion framework" % p)
     24 
     25 
     26 def is_ParentWithBase(x):
     27     """
     28     Return True if x is a parent object with base.
     29     """
     30     return isinstance(x, ParentWithBase)
     31 

/usr/lib64/python3.6/site-packages/sage/structure/parent_old.pyx in init 
sage.structure.parent_old()
----> 1 r"""
      2 Base class for old-style parent objects
      3 
      4 CLASS HIERARCHY:
      5 
      6 SageObject
      7     Parent
      8         ParentWithBase
      9             ParentWithGens
     10 
     11 
     12 TESTS:
     13 
     14 This came up in some subtle bug once.
     15 ::
     16 
     17     sage: gp(2) + gap(3)
     18     5
     19 """
     20 
     21 
#*****************************************************************************
     22 #       Copyright (C) 2006 William Stein <wst...@gmail.com>
     23 #
     24 # This program is free software: you can redistribute it and/or modify
     25 # it under the terms of the GNU General Public License as published by
     26 # the Free Software Foundation, either version 2 of the License, or
     27 # (at your option) any later version.
     28 #                  http://www.gnu.org/licenses/
     29 
#*****************************************************************************
     30 from __future__ import absolute_import, print_function
     31 

/usr/lib64/python3.6/site-packages/sage/structure/parent.pyx in init 
sage.structure.parent()
----> 1 r"""
      2 Base class for parent objects
      3 
      4 CLASS HIERARCHY::
      5 
      6     SageObject
      7         CategoryObject
      8             Parent
      9 
     10 A simple example of registering coercions::
     11 
     12     sage: class A_class(Parent):
     13     ....:   def __init__(self, name):
     14     ....:       Parent.__init__(self, name=name)
     15     ....:       self._populate_coercion_lists_()
     16     ....:       self.rename(name)
     17     ....:   #
     18     ....:   def category(self):
     19     ....:       return Sets()
     20     ....:   #
     21     ....:   def _element_constructor_(self, i):
     22     ....:       assert(isinstance(i, (int, Integer)))
     23     ....:       return ElementWrapper(self, i)
     24     ....:
     25     sage: A = A_class("A")
     26     sage: B = A_class("B")
     27     sage: C = A_class("C")
     28 
     29     sage: def f(a):
     30     ....:   return B(a.value+1)
     31     ....:

/usr/lib64/python3.6/site-packages/sage/structure/category_object.pyx in init 
sage.structure.category_object()
     47     ((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))
     48 """
     49 
     50 
#*****************************************************************************
     51 # This program is free software: you can redistribute it and/or modify
     52 # it under the terms of the GNU General Public License as published by
     53 # the Free Software Foundation, either version 2 of the License, or
     54 # (at your option) any later version.
     55 #                  http://www.gnu.org/licenses/
     56 
#*****************************************************************************
     57 
     58 from __future__ import absolute_import, division, print_function
     59 
     60 from sage.cpython.getattr import dir_with_other_class
     61 from sage.cpython.getattr cimport getattr_from_other_class
---> 62 from sage.categories.category import Category
        global sage.categories.category = undefined
        global Category = undefined
     63 from sage.structure.debug_options cimport debug
     64 from sage.misc.cachefunc import cached_method
     65 
     66 
     67 def guess_category(obj):
     68     # this should be obsolete if things declare their categories
     69     try:
     70         if obj.is_field():
     71             from sage.categories.all import Fields
     72             return Fields()
     73     except (AttributeError, NotImplementedError):
     74         pass
     75     try:
     76         if obj.is_ring():
     77             from sage.categories.all import CommutativeAlgebras, 
Algebras, CommutativeRings, Rings

/usr/lib64/python3.6/site-packages/sage/categories/category.py in <module>()
     90 
#*****************************************************************************
     91 #  Copyright (C) 2005      David Kohel <ko...@maths.usyd.edu> and
     92 #                          William Stein <wst...@math.ucsd.edu>
     93 #                2008-2014 Nicolas M. Thiery <nthiery at users.sf.net>
     94 #
     95 #  Distributed under the terms of the GNU General Public License (GPL)
     96 #                  http://www.gnu.org/licenses/
     97 
#*****************************************************************************
     98 
     99 import inspect
    100 from warnings import warn
    101 from sage.misc.abstract_method import abstract_method, 
abstract_methods_of_class
    102 from sage.misc.cachefunc import cached_method, cached_function
    103 from sage.misc.c3_controlled import _cmp_key, _cmp_key_named, 
C3_sorted_merge
    104 from sage.misc.lazy_attribute import lazy_attribute
--> 105 from sage.misc.unknown import Unknown
        global sage.misc.unknown = undefined
        global Unknown = undefined
    106 from sage.misc.weak_dict import WeakValueDictionary
    107 
    108 from sage.structure.sage_object import SageObject
    109 from sage.structure.unique_representation import UniqueRepresentation
    110 from sage.structure.dynamic_class import DynamicMetaclass, dynamic_class
    111 
    112 from sage.categories.category_cy_helper import category_sort_key, 
_sort_uniq, _flatten_categories, join_as_tuple
    113 
    114 _join_cache = WeakValueDictionary()
    115 
    116 class Category(UniqueRepresentation, SageObject):
    117     r"""
    118     The base class for modeling mathematical categories, like for 
example:
    119 
    120     - ``Groups()``: the category of groups

/usr/lib64/python3.6/site-packages/sage/misc/unknown.py in <module>()
    157             sage: for a in l: print([a <= b for b in l])
    158             [True, True, True]
    159             [False, True, True]
    160             [False, False, True]
    161         """
    162         if other is self:
    163             return 0
    164         if isinstance(other, bool):
    165             if other:
    166                 return -1
    167             else:
    168                 return +1
    169         else:
    170             raise ValueError("Unable to compare {} with 
{}".format(self, other))
    171 
--> 172 Unknown = UnknownClass()
        global Unknown = undefined
        global UnknownClass = <class 'sage.misc.unknown.UnknownClass'>

/usr/lib64/python3.6/site-packages/sage/misc/classcall_metaclass.pyx in 
sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/classcall_metaclass.c:1469)()

/usr/lib64/python3.6/site-packages/sage/misc/cachefunc.pyx in 
sage.misc.cachefunc.CachedFunction.__call__ 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/cachefunc.c:5983)()

/usr/lib64/python3.6/site-packages/sage/misc/cachefunc.pyx in 
sage.misc.cachefunc.CachedFunction.get_key_args_kwds 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/cachefunc.c:4306)()

/usr/lib64/python3.6/site-packages/sage/misc/cachefunc.pyx in 
sage.misc.cachefunc.CachedFunction.fix_args_kwds 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/cachefunc.c:4451)()

/usr/lib64/python3.6/site-packages/sage/misc/cachefunc.pyx in 
sage.misc.cachefunc.CachedFunction.argfix_init 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/cachefunc.c:4381)()

/usr/lib64/python3.6/site-packages/sage/misc/function_mangling.pyx in 
sage.misc.function_mangling.ArgumentFixer.__init__ 
(/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python3_6/build/cythonized/sage/misc/function_mangling.c:1298)()

/usr/lib64/python3.6/site-packages/sage/misc/sageinspect.py in 
sage_getargspec(obj=<function CachedRepresentation.__classcall__>)
   1425     if isinstance(obj, (lazy_attribute, AbstractMethod)):
   1426         source = sage_getsource(obj)
   1427         return inspect.ArgSpec(*_sage_getargspec_cython(source))
   1428     if not callable(obj):
   1429         raise TypeError("obj is not a code object")
   1430     try:
   1431         return inspect.ArgSpec(*obj._sage_argspec_())
   1432     except (AttributeError, TypeError):
   1433         pass
   1434     # If we are lucky, the function signature is embedded in the 
docstring.
   1435     docstring = _sage_getdoc_unformatted(obj)
   1436     try:
   1437         name = obj.__name__
   1438     except AttributeError:
   1439         name = type(obj).__name__
-> 1440     argspec = _extract_embedded_signature(docstring, name)[1]
        argspec = undefined
        global _extract_embedded_signature = <function 
_extract_embedded_signature at 0x7f3d5abaa0d0>
        docstring = b'\n        Construct a new object of this class or reuse 
an existing one.\n\n        See also :class:`CachedRepresentation` and\n        
:class:`UniqueRepresentation` for a discussion.\n\n        EXAMPLES::\n\n       
     sage: x = UniqueRepresentation()\n            sage: y = 
UniqueRepresentation()\n            sage: x is y   # indirect doctest\n         
   True\n        '
        name = '__classcall__'
   1441     if argspec is not None:
   1442         return argspec
   1443     if hasattr(obj, '__code__'):
   1444         # Note that this may give a wrong result for the constants!
   1445         try:
   1446             args, varargs, varkw = inspect.getargs(obj.__code__)
   1447             return inspect.ArgSpec(args, varargs, varkw, 
obj.__defaults__)
   1448         except (TypeError, AttributeError):
   1449             pass
   1450     if isclassinstance(obj):
   1451         if hasattr(obj,'_sage_src_'): #it may be a decorator!
   1452             source = sage_getsource(obj)
   1453             # we try to find the definition and parse it by 
_sage_getargspec_ast
   1454             proxy = 'def dummy' + 
_grep_first_pair_of_parentheses(source) + ':\n    return'
   1455             try:

/usr/lib64/python3.6/site-packages/sage/misc/sageinspect.py in 
_extract_embedded_signature(docstring=b'\n        Construct a new object of 
this class...  # indirect doctest\n            True\n        ', 
name='__classcall__')
    245 
    246     EXAMPLES::
    247 
    248         sage: from sage.misc.sageinspect import 
_extract_embedded_signature
    249         sage: from sage.misc.nested_class import MainClass
    250         sage: 
print(_extract_embedded_signature(MainClass.NestedClass.NestedSubClass.dummy.__doc__,
 'dummy')[0])
    251         File: sage/misc/nested_class.pyx (starting at line 314)
    252         ...
    253         sage: 
_extract_embedded_signature(MainClass.NestedClass.NestedSubClass.dummy.__doc__, 
'dummy')[1]
    254         ArgSpec(args=['self', 'x', 'r'], varargs='args', 
keywords='kwds', defaults=((1, 2, 3.4),))
    255         sage: _extract_embedded_signature(range.__call__.__doc__, 
'__call__')
    256         ('x.__call__(...) <==> x(...)', None)
    257 
    258     """
    259     # If there is an embedded signature, it is in the first line
--> 260     L = docstring.split(os.linesep, 1)
        L = undefined
        docstring.split = <built-in method split of bytes object at 
0x7f3d589de990>
        global os.linesep = '\n'
    261     firstline = L[0]
    262     # It is possible that the signature is of the form 
ClassName.method_name,
    263     # and thus we need to do the following:
    264     if name not in firstline:
    265         return docstring, None
    266     signature = firstline.split(name, 1)[-1]
    267     if signature.startswith("(") and signature.endswith(")"):
    268         docstring = L[1] if len(L)>1 else '' # Remove first line, keep 
the rest
    269         def_string = "def "+name+signature+": pass"
    270         try:
    271             return docstring, 
inspect.ArgSpec(*_sage_getargspec_cython(def_string))
    272         except SyntaxError:
    273             docstring = os.linesep.join(L)
    274     return docstring, None
    275 

TypeError: a bytes-like object is required, not 'str'

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

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

Reply via email to