Hi team, This issue happened to me just one day ago.
I am aware of https://trac.sagemath.org/ticket/18492 and https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1671690.html as they have the same TypeError, but I think that is not my case. Thanks for the help in advance! -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3937625d-d740-45f0-af07-7eeb64297a26o%40googlegroups.com.
*************************************************************************** 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.13.0', 'os_name': 'posix', 'platform': 'Linux-5.4.0-42-generic-x86_64-with-glibc2.29', 'sys_executable': '/usr/bin/python3', 'sys_platform': 'linux', 'sys_version': '3.8.2 (default, Jul 16 2020, 14:00:26) \n[GCC 9.3.0]'} *************************************************************************** *************************************************************************** Crash traceback: --------------------------------------------------------------------------- --------------------------------------------------------------------------- TypeError Python 3.8.2: /usr/bin/python3 Mon Aug 3 09:29:12 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 0x7fcd35ef4160>> 16 app.start() <decorator-gen-113> in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None) /usr/lib/python3/dist-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 0x7fcd347b9040> app = <sage.repl.interpreter.SageTerminalApp object at 0x7fcd35ef4160> args = (None,) kwargs = {} 88 except (TraitError, ArgumentError) as e: 89 app.print_help() 90 app.log.fatal("Bad config encountered during initialization:") 91 app.log.fatal(str(e)) 92 app.log.debug("Config at the time: %s", app.config) 93 app.exit(1) 94 95 96 class ApplicationError(Exception): 97 pass 98 99 100 class LevelFormatter(logging.Formatter): 101 """Formatter with additional `highlevel` record 102 /usr/lib/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 0x7fcd35ef4160>> 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>) 706 Initialize the :class:`SageInteractiveShell` instance. 707 708 .. note:: 709 710 This code is based on 711 :meth:`TerminalIPythonApp.init_shell`. 712 713 EXAMPLES:: 714 715 sage: from sage.repl.interpreter import SageTerminalApp 716 sage: app = SageTerminalApp.instance() 717 sage: app.shell 718 <sage.repl.interpreter.SageTestShell object at 0x...> 719 """ 720 # Shell initialization --> 721 self.shell = self.shell_class.instance( self.shell = None self.shell_class.instance = <bound method SingletonConfigurable.instance of <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>> global parent = undefined self = <sage.repl.interpreter.SageTerminalApp object at 0x7fcd35ef4160> global config = undefined self.config = {'TerminalIPythonApp': {'display_banner': False, 'verbose_crash': True, 'test_shell': False, 'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>}, 'InteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'TerminalInteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'InteractiveShellApp': {'extensions': ['sage']}, 'SageTerminalApp': {'force_interact': True}} global profile_dir = undefined self.profile_dir = <IPython.core.profiledir.ProfileDir object at 0x7fcd35d736a0> global ipython_dir = undefined self.ipython_dir = '/home/mystiz/.ipython' 722 parent=self, 723 config=self.config, 724 profile_dir=self.profile_dir, 725 ipython_dir=self.ipython_dir) 726 self.shell.configurables.append(self) 727 self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions 728 729 # Load the %lprun extension if available 730 try: 731 import line_profiler 732 except ImportError: 733 pass 734 else: 735 self.extensions.append('line_profiler') 736 /usr/lib/python3/dist-packages/traitlets/config/configurable.py in instance(cls=<class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, *args=(), **kwargs={'config': {'TerminalIPythonApp': {'display_banner': False,...']}, 'SageTerminalApp': {'force_interact': True}}, 'ipython_dir': '/home/mystiz/.ipython', 'parent': <sage.repl.interpreter.SageTerminalApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>}) 397 >>> class Foo(SingletonConfigurable): pass 398 >>> foo = Foo.instance() 399 >>> foo == Foo.instance() 400 True 401 402 Create a subclass that is retrived using the base class instance:: 403 404 >>> class Bar(SingletonConfigurable): pass 405 >>> class Bam(Bar): pass 406 >>> bam = Bam.instance() 407 >>> bam == Bar.instance() 408 True 409 """ 410 # Create and save the instance 411 if cls._instance is None: --> 412 inst = cls(*args, **kwargs) inst = undefined cls = <class 'sage.repl.interpreter.SageTerminalInteractiveShell'> args = () kwargs = {'parent': <sage.repl.interpreter.SageTerminalApp object at 0x7fcd35ef4160>, 'config': {'TerminalIPythonApp': {'display_banner': False, 'verbose_crash': True, 'test_shell': False, 'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>}, 'InteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'TerminalInteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'InteractiveShellApp': {'extensions': ['sage']}, 'SageTerminalApp': {'force_interact': True}}, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x7fcd35d736a0>, 'ipython_dir': '/home/mystiz/.ipython'} 413 # Now make sure that the instance will also be returned by 414 # parent classes' _instance attribute. 415 for subclass in cls._walk_mro(): 416 subclass._instance = inst 417 418 if isinstance(cls._instance, cls): 419 return cls._instance 420 else: 421 raise MultipleInstanceError( 422 'Multiple incompatible subclass instances of ' 423 '%s are being created.' % cls.__name__ 424 ) 425 426 @classmethod 427 def initialized(cls): /usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py in __init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, *args=(), **kwargs={'config': {'TerminalIPythonApp': {'display_banner': False,...']}, 'SageTerminalApp': {'force_interact': True}}, 'ipython_dir': '/home/mystiz/.ipython', 'parent': <sage.repl.interpreter.SageTerminalApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>}) 504 505 def init_alias(self): 506 # The parent class defines aliases that can be safely used with any 507 # frontend. 508 super(TerminalInteractiveShell, self).init_alias() 509 510 # Now define aliases that only make sense on the terminal, because they 511 # need direct access to the console in a way that we can't emulate in 512 # GUI or web frontend 513 if os.name == 'posix': 514 for cmd in ('clear', 'more', 'less', 'man'): 515 self.alias_manager.soft_define_alias(cmd, cmd) 516 517 518 def __init__(self, *args, **kwargs): --> 519 super(TerminalInteractiveShell, self).__init__(*args, **kwargs) global super = undefined global TerminalInteractiveShell = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'> self.__init__ = <bound method TerminalInteractiveShell.__init__ of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fcd347b5f40>> args = () kwargs = {'parent': <sage.repl.interpreter.SageTerminalApp object at 0x7fcd35ef4160>, 'config': {'TerminalIPythonApp': {'display_banner': False, 'verbose_crash': True, 'test_shell': False, 'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>}, 'InteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'TerminalInteractiveShell': {'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'ast_node_interactivity': 'all', 'colors': 'LightBG', 'simple_prompt': False, 'term_title': True, 'confirm_exit': False, 'separate_in': ''}, 'InteractiveShellApp': {'extensions': ['sage']}, 'SageTerminalApp': {'force_interact': True}}, 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x7fcd35d736a0>, 'ipython_dir': '/home/mystiz/.ipython'} 520 self.init_prompt_toolkit_cli() 521 self.init_term_title() 522 self.keep_running = True 523 524 self.debugger_history = InMemoryHistory() 525 526 def ask_exit(self): 527 self.keep_running = False 528 529 rl_next_input = None 530 531 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED): 532 533 if display_banner is not DISPLAY_BANNER_DEPRECATED: 534 warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) /usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in __init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, ipython_dir='/home/mystiz/.ipython', profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, user_ns=None, custom_exceptions=((), None), **kwargs={'config': {'TerminalIPythonApp': {'display_banner': False,...']}, 'SageTerminalApp': {'force_interact': True}}, 'parent': <sage.repl.interpreter.SageTerminalApp object>}) 668 self.init_pushd_popd_magic() 669 self.init_user_ns() 670 self.init_logger() 671 self.init_builtins() 672 673 # The following was in post_config_initialization 674 self.init_inspector() 675 self.raw_input_original = input 676 self.init_completer() 677 # TODO: init_io() needs to happen before init_traceback handlers 678 # because the traceback handlers hardcode the stdout/stderr streams. 679 # This logic in in debugger.Pdb and should eventually be changed. 680 self.init_io() 681 self.init_traceback_handlers(custom_exceptions) 682 self.init_prompts() --> 683 self.init_display_formatter() self.init_display_formatter = <bound method SageTerminalInteractiveShell.init_display_formatter of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7fcd347b5f40>> 684 self.init_display_pub() 685 self.init_data_pub() 686 self.init_displayhook() 687 self.init_magics() 688 self.init_alias() 689 self.init_logstart() 690 self.init_pdb() 691 self.init_extension_manager() 692 self.init_payload() 693 self.init_deprecation_warnings() 694 self.hooks.late_startup_hook() 695 self.events.trigger('shell_initialized', self) 696 atexit.register(self.atexit_operations) 697 698 # The trio runner is used for running Trio in the foreground thread. It /usr/lib/python3/dist-packages/sage/repl/interpreter.py in init_display_formatter(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>) 242 243 sage: from sage.repl.interpreter import SageTerminalInteractiveShell 244 sage: SageTerminalInteractiveShell() # not tested 245 <sage.repl.interpreter.SageNotebookInteractiveShell object at 0x...> 246 """ 247 248 def init_display_formatter(self): 249 """ 250 Switch to the Sage IPython commandline rich output backend 251 252 EXAMPLES:: 253 254 sage: from sage.repl.interpreter import SageTerminalInteractiveShell 255 sage: SageTerminalInteractiveShell().init_display_formatter() # not tested 256 """ --> 257 from sage.repl.rich_output.backend_ipython import BackendIPythonCommandline global sage.repl.rich_output.backend_ipython = undefined BackendIPythonCommandline = undefined 258 backend = BackendIPythonCommandline() 259 backend.get_display_manager().switch_backend(backend, shell=self) 260 261 262 class SageTestShell(SageShellOverride, TerminalInteractiveShell): 263 """ 264 Test Shell 265 266 Care must be taken in these doctests to quit the test shell in 267 order to switch back the rich output display backend to the 268 doctest backend. 269 270 EXAMPLES:: 271 272 sage: from sage.repl.interpreter import get_test_shell /usr/lib/python3/dist-packages/sage/repl/rich_output/__init__.py in <module> 1 # -*- encoding: utf-8 -*- 2 ----> 3 from .display_manager import get_display_manager global display_manager = undefined global get_display_manager = undefined 4 from .pretty_print import pretty_print 5 6 /usr/lib/python3/dist-packages/sage/repl/rich_output/display_manager.py in <module> 24 The Sage display manager using the doctest backend 25 """ 26 27 # **************************************************************************** 28 # Copyright (C) 2015 Volker Braun <vbraun.n...@gmail.com> 29 # 30 # Distributed under the terms of the GNU General Public License (GPL) 31 # as published by the Free Software Foundation; either version 2 of 32 # the License, or (at your option) any later version. 33 # http://www.gnu.org/licenses/ 34 # **************************************************************************** 35 36 37 import warnings 38 ---> 39 from sage.structure.sage_object import SageObject global sage.structure.sage_object = undefined global SageObject = undefined 40 from sage.repl.rich_output.output_basic import ( 41 OutputPlainText, OutputAsciiArt, OutputUnicodeArt, OutputLatex, 42 ) 43 from sage.repl.rich_output.preferences import DisplayPreferences 44 45 46 class DisplayException(Exception): 47 """ 48 Base exception for all rich output-related exceptions. 49 50 EXAMPLES:: 51 52 sage: from sage.repl.rich_output.display_manager import DisplayException 53 sage: raise DisplayException('foo') 54 Traceback (most recent call last): /usr/lib/python3/dist-packages/sage/structure/__init__.py in <module> 1 # Resolve a cyclic import ----> 2 import sage.structure.element global sage.structure.element = undefined /usr/lib/python3/dist-packages/sage/structure/category_object.pxd in init sage.structure.element (build/cythonized/sage/structure/element.c:34132)() 1 #***************************************************************************** 2 # Copyright (C) 2006 William Stein <wst...@gmail.com> 3 # 4 # This program is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation, either version 2 of the License, or 7 # (at your option) any later version. 8 # http://www.gnu.org/licenses/ 9 #***************************************************************************** 10 11 from sage.structure.sage_object cimport SageObject 12 13 cpdef check_default_category(default_category, category) 14 ---> 15 cdef class CategoryObject(SageObject): global cdef = undefined global CategoryObject = undefined global SageObject = undefined 16 cdef public dict __cached_methods 17 cdef _category 18 cdef public _base 19 cdef public _names 20 cdef public _factory_data 21 cdef object __weakref__ 22 cdef long _hash_value 23 24 cdef getattr_from_category(self, name) 25 26 cpdef normalize_names(Py_ssize_t ngens, names) 27 cpdef bint certify_names(names) except -1 /usr/lib/python3/dist-packages/sage/structure/category_object.pyx in init sage.structure.category_object (build/cythonized/sage/structure/category_object.c:9881)() 45 (1, 0, 0, 0) 46 sage: M.gens() 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 sage.cpython.getattr import dir_with_other_class 59 from sage.cpython.getattr cimport getattr_from_other_class ---> 60 from sage.categories.category import Category global sage.categories.category = undefined global Category = undefined 61 from sage.structure.debug_options cimport debug 62 from sage.misc.cachefunc import cached_method 63 from sage.structure.dynamic_class import DynamicMetaclass 64 65 66 cpdef inline check_default_category(default_category, category): 67 ## The resulting category is guaranteed to be 68 ## a sub-category of the default. 69 if category is None: 70 return default_category 71 return default_category.join([default_category,category]) 72 73 74 cdef class CategoryObject(SageObject): 75 """ /usr/lib/python3/dist-packages/sage/categories/category.py in <module> 95 # **************************************************************************** 96 # Copyright (C) 2005 David Kohel <ko...@maths.usyd.edu> and 97 # William Stein <wst...@math.ucsd.edu> 98 # 2008-2014 Nicolas M. Thiery <nthiery at users.sf.net> 99 # 100 # Distributed under the terms of the GNU General Public License (GPL) 101 # https://www.gnu.org/licenses/ 102 # **************************************************************************** 103 104 import inspect 105 from warnings import warn 106 from sage.misc.abstract_method import abstract_method, abstract_methods_of_class 107 from sage.misc.cachefunc import cached_method, cached_function 108 from sage.misc.c3_controlled import _cmp_key, _cmp_key_named, C3_sorted_merge 109 from sage.misc.lazy_attribute import lazy_attribute --> 110 from sage.misc.unknown import Unknown global sage.misc.unknown = undefined global Unknown = undefined 111 from sage.misc.weak_dict import WeakValueDictionary 112 113 from sage.structure.sage_object import SageObject 114 from sage.structure.unique_representation import UniqueRepresentation 115 from sage.structure.dynamic_class import DynamicMetaclass, dynamic_class 116 117 from sage.categories.category_cy_helper import category_sort_key, _sort_uniq, _flatten_categories, join_as_tuple 118 119 _join_cache = WeakValueDictionary() 120 121 class Category(UniqueRepresentation, SageObject): 122 r""" 123 The base class for modeling mathematical categories, like for example: 124 125 - ``Groups()``: the category of groups /usr/lib/python3/dist-packages/sage/misc/unknown.py in <module> 1 """ 2 The Unknown truth value 3 4 AUTHORS: 5 6 - Florent Hivert (2010): initial version. 7 """ 8 from __future__ import print_function 9 10 from sage.structure.sage_object import SageObject ---> 11 from sage.structure.unique_representation import UniqueRepresentation global sage.structure.unique_representation = undefined global UniqueRepresentation = undefined 12 from sage.structure.richcmp import richcmp_method, rich_to_bool 13 14 15 @richcmp_method 16 class UnknownClass(UniqueRepresentation, SageObject): 17 """ 18 TESTS:: 19 20 sage: TestSuite(Unknown).run() 21 """ 22 def __init__(self): 23 """ 24 The ``Unknown`` truth value 25 26 EXAMPLES:: 27 28 sage: l = [False, Unknown, True] 29 sage: for a in l: print([a and b for b in l]) 30 [False, False, False] 31 [Unknown, Unknown, Unknown] /usr/lib/python3/dist-packages/sage/structure/unique_representation.py in <module> 555 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 556 # General Public License for more details. 557 # 558 # The full text of the GPL is available at: 559 # 560 # https://www.gnu.org/licenses/ 561 #****************************************************************************** 562 from __future__ import print_function 563 564 from sage.misc import six 565 from sage.misc.cachefunc import weak_cached_function 566 from sage.misc.classcall_metaclass import ClasscallMetaclass, typecall 567 from sage.misc.fast_methods import WithEqualityById 568 569 --> 570 class CachedRepresentation(six.with_metaclass(ClasscallMetaclass)): global CachedRepresentation = undefined global six.with_metaclass = <function with_metaclass at 0x7fcd35d32700> global ClasscallMetaclass = <class 'sage.misc.classcall_metaclass.ClasscallMetaclass'> 571 """ 572 Classes derived from CachedRepresentation inherit a weak cache for their 573 instances. 574 575 .. NOTE:: 576 577 If this class is used as a base class, then instances are (weakly) 578 cached, according to the arguments used to create the instance. 579 Pickling is provided, of course by using the cache. 580 581 .. NOTE:: 582 583 Using this class, one can have arbitrary hash and comparison. 584 Hence, *unique* representation behaviour is *not* provided. 585 ~/.local/lib/python3.8/site-packages/six.py in with_metaclass(meta=<class 'sage.misc.classcall_metaclass.ClasscallMetaclass'>, *bases=()) 794 return f 795 return wrapper 796 else: 797 wraps = functools.wraps 798 799 800 def with_metaclass(meta, *bases): 801 """Create a base class with a metaclass.""" 802 # This requires a bit of explanation: the basic idea is to make a dummy 803 # metaclass for one level of class instantiation that replaces itself with 804 # the actual metaclass. 805 class metaclass(meta): 806 807 def __new__(cls, name, this_bases, d): 808 return meta(name, bases, d) --> 809 return type.__new__(metaclass, 'temporary_class', (), {}) global type.__new__ = undefined metaclass = <class 'six.with_metaclass.<locals>.metaclass'> 810 811 812 def add_metaclass(metaclass): 813 """Class decorator for creating a class with a metaclass.""" 814 def wrapper(cls): 815 orig_vars = cls.__dict__.copy() 816 slots = orig_vars.get('__slots__') 817 if slots is not None: 818 if isinstance(slots, str): 819 slots = [slots] 820 for slots_var in slots: 821 orig_vars.pop(slots_var) 822 orig_vars.pop('__dict__', None) 823 orig_vars.pop('__weakref__', None) 824 return metaclass(cls.__name__, cls.__bases__, orig_vars) TypeError: type.__new__(metaclass) is not safe, use sage.misc.classcall_metaclass.ClasscallMetaclass.__new__() *************************************************************************** History of session input: