Ticket #22612: Sage_crash_report.txt

File Sage_crash_report.txt, 42.0 KB (added by ajdunlap, 4 years ago)

Crash report

Line 
1***************************************************************************
2
3IPython post-mortem report
4
5{'commit_hash': u'<not found>',
6 'commit_source': '(none found)',
7 'default_encoding': 'UTF-8',
8 'ipython_path': '/usr/lib/python2.7/site-packages/IPython',
9 'ipython_version': '5.1.0',
10 'os_name': 'posix',
11 'platform': 'Linux-4.10.1-1-ARCH-x86_64-with-glibc2.2.5',
12 'sys_executable': '/usr/bin/python2',
13 'sys_platform': 'linux2',
14 'sys_version': '2.7.13 (default, Dec 21 2016, 07:16:46) \n[GCC 6.2.1 20160830]'}
15
16***************************************************************************
17
18
19
20***************************************************************************
21
22Crash traceback:
23
24---------------------------------------------------------------------------
25---------------------------------------------------------------------------
26KeyboardInterrupt                           Python 2.7.13: /usr/bin/python2
27                                                   Wed Mar 15 14:23:35 2017
28A problem occurred executing Python code.  Here is the sequence of function
29calls leading up to the error, with the most recent (innermost) call last.
30/usr/bin/sage-ipython in <module>()
31      1 #!/usr/bin/env python2
32      2 # -*- coding: utf-8 -*-
33      3 """
34      4 Sage IPython startup script.
35      5 """
36      6
37      7 from sage.repl.interpreter import SageTerminalApp
38      8
39      9 app = SageTerminalApp.instance()
40---> 10 app.initialize()
41        global app.initialize = <bound method SageTerminalApp.initialize of <sage.repl.interpreter.SageTerminalApp object at 0x7f249c161e10>>
42     11 app.start()
43
44<decorator-gen-109> in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
45
46/usr/lib/python2.7/site-packages/traitlets/config/application.pyc in catch_config_error(method=<function initialize>, app=<sage.repl.interpreter.SageTerminalApp object>, *args=(None,), **kwargs={})
47     72     TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR = False
48     73 else:
49     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 )
50     75
51     76
52     77 @decorator
53     78 def catch_config_error(method, app, *args, **kwargs):
54     79     """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
55     80
56     81     On a TraitError (generally caused by bad config), this will print the trait's
57     82     message, and exit the app.
58     83
59     84     For use on init methods, to prevent invoking excepthook on invalid input.
60     85     """
61     86     try:
62---> 87         return method(app, *args, **kwargs)
63        method = <function initialize at 0x7f2494a7e6e0>
64        app = <sage.repl.interpreter.SageTerminalApp object at 0x7f249c161e10>
65        args = (None,)
66        kwargs = {}
67     88     except (TraitError, ArgumentError) as e:
68     89         app.print_help()
69     90         app.log.fatal("Bad config encountered during initialization:")
70     91         app.log.fatal(str(e))
71     92         app.log.debug("Config at the time: %s", app.config)
72     93         app.exit(1)
73     94
74     95
75     96 class ApplicationError(Exception):
76     97     pass
77     98
78     99
79    100 class LevelFormatter(logging.Formatter):
80    101     """Formatter with additional `highlevel` record
81    102
82
83/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc in initialize(self=<sage.repl.interpreter.SageTerminalApp object>, argv=None)
84    294
85    295         return super(TerminalIPythonApp, self).parse_command_line(argv)
86    296     
87    297     @catch_config_error
88    298     def initialize(self, argv=None):
89    299         """Do actions after construct, but before starting the app."""
90    300         super(TerminalIPythonApp, self).initialize(argv)
91    301         if self.subapp is not None:
92    302             # don't bother initializing further, starting subapp
93    303             return
94    304         # print self.extra_args
95    305         if self.extra_args and not self.something_to_run:
96    306             self.file_to_run = self.extra_args[0]
97    307         self.init_path()
98    308         # create the shell
99--> 309         self.init_shell()
100        self.init_shell = <bound method SageTerminalApp.init_shell of <sage.repl.interpreter.SageTerminalApp object at 0x7f249c161e10>>
101    310         # and draw the banner
102    311         self.init_banner()
103    312         # Now a variety of things that happen after the banner is printed.
104    313         self.init_gui_pylab()
105    314         self.init_extensions()
106    315         self.init_code()
107    316
108    317     def init_shell(self):
109    318         """initialize the InteractiveShell instance"""
110    319         # Create an InteractiveShell instance.
111    320         # shell.display_banner should always be False for the terminal
112    321         # based app, because we call shell.show_banner() by hand below
113    322         # so the banner shows *before* all extension loading stuff.
114    323         self.shell = TerminalInteractiveShell.instance(parent=self,
115    324                         profile_dir=self.profile_dir,
116
117/usr/lib/python2.7/site-packages/sage/repl/interpreter.pyc in init_shell(self=<sage.repl.interpreter.SageTerminalApp object>)
118    730             This code is based on
119    731             :meth:`TerminalIPythonApp.init_shell`.
120    732
121    733         EXAMPLES::
122    734
123    735             sage: from sage.repl.interpreter import SageTerminalApp
124    736             sage: app = SageTerminalApp.instance()
125    737             sage: app.shell
126    738             <sage.repl.interpreter.SageTestShell object at 0x...>
127    739         """
128    740         # Shell initialization
129    741         self.shell = self.shell_class.instance(
130    742             parent=self,
131    743             config=self.config,
132    744             profile_dir=self.profile_dir,
133--> 745             ipython_dir=self.ipython_dir)
134        global ipython_dir = undefined
135        self.ipython_dir = u'/home/ajd/.sage/ipython-5.0.0'
136    746         self.shell.configurables.append(self)
137    747         self.shell.has_sage_extensions = SAGE_EXTENSION in self.extensions
138    748
139    749         # Load the %lprun extension if available
140    750         try:
141    751             import line_profiler
142    752         except ImportError:
143    753             pass
144    754         else:
145    755             self.extensions.append('line_profiler')
146    756
147    757         if self.shell.has_sage_extensions:
148    758             self.extensions.remove(SAGE_EXTENSION)
149    759
150    760             # load sage extension here to get a crash if
151
152/usr/lib/python2.7/site-packages/traitlets/config/configurable.pyc in instance(cls=<class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, *args=(), **kwargs={'config': {'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}}, 'ipython_dir': u'/home/ajd/.sage/ipython-5.0.0', 'parent': <sage.repl.interpreter.SageTerminalApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>})
153    397             >>> class Foo(SingletonConfigurable): pass
154    398             >>> foo = Foo.instance()
155    399             >>> foo == Foo.instance()
156    400             True
157    401
158    402         Create a subclass that is retrived using the base class instance::
159    403
160    404             >>> class Bar(SingletonConfigurable): pass
161    405             >>> class Bam(Bar): pass
162    406             >>> bam = Bam.instance()
163    407             >>> bam == Bar.instance()
164    408             True
165    409         """
166    410         # Create and save the instance
167    411         if cls._instance is None:
168--> 412             inst = cls(*args, **kwargs)
169        inst = undefined
170        cls = <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>
171        args = ()
172        kwargs = {'ipython_dir': u'/home/ajd/.sage/ipython-5.0.0', 'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x7f24948c24d0>, 'config': {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}, 'parent': <sage.repl.interpreter.SageTerminalApp object at 0x7f249c161e10>}
173    413             # Now make sure that the instance will also be returned by
174    414             # parent classes' _instance attribute.
175    415             for subclass in cls._walk_mro():
176    416                 subclass._instance = inst
177    417
178    418         if isinstance(cls._instance, cls):
179    419             return cls._instance
180    420         else:
181    421             raise MultipleInstanceError(
182    422                 'Multiple incompatible subclass instances of '
183    423                 '%s are being created.' % cls.__name__
184    424             )
185    425
186    426     @classmethod
187    427     def initialized(cls):
188
189/usr/lib/python2.7/site-packages/IPython/terminal/interactiveshell.pyc in __init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, *args=(), **kwargs={'config': {'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}}, 'ipython_dir': u'/home/ajd/.sage/ipython-5.0.0', 'parent': <sage.repl.interpreter.SageTerminalApp object>, 'profile_dir': <IPython.core.profiledir.ProfileDir object>})
190    381
191    382     def init_alias(self):
192    383         # The parent class defines aliases that can be safely used with any
193    384         # frontend.
194    385         super(TerminalInteractiveShell, self).init_alias()
195    386
196    387         # Now define aliases that only make sense on the terminal, because they
197    388         # need direct access to the console in a way that we can't emulate in
198    389         # GUI or web frontend
199    390         if os.name == 'posix':
200    391             for cmd in ['clear', 'more', 'less', 'man']:
201    392                 self.alias_manager.soft_define_alias(cmd, cmd)
202    393
203    394
204    395     def __init__(self, *args, **kwargs):
205--> 396         super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
206        global super = undefined
207        global TerminalInteractiveShell = <class 'IPython.terminal.interactiveshell.TerminalInteractiveShell'>
208        self.__init__ = <bound method SageTerminalInteractiveShell.__init__ of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f2494cf9f90>>
209        args = ()
210        kwargs = {'profile_dir': <IPython.core.profiledir.ProfileDir object at 0x7f24948c24d0>, 'config': {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}, 'ipython_dir': u'/home/ajd/.sage/ipython-5.0.0', 'parent': <sage.repl.interpreter.SageTerminalApp object at 0x7f249c161e10>}
211    397         self.init_prompt_toolkit_cli()
212    398         self.init_term_title()
213    399         self.keep_running = True
214    400
215    401         self.debugger_history = InMemoryHistory()
216    402
217    403     def ask_exit(self):
218    404         self.keep_running = False
219    405
220    406     rl_next_input = None
221    407
222    408     def pre_prompt(self):
223    409         if self.rl_next_input:
224    410             self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input)
225    411             self.rl_next_input = None
226
227/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in __init__(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>, ipython_dir=u'/home/ajd/.sage/ipython-5.0.0', profile_dir=<IPython.core.profiledir.ProfileDir object>, user_module=None, user_ns=None, custom_exceptions=((), None), **kwargs={'config': {'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}}, 'parent': <sage.repl.interpreter.SageTerminalApp object>})
228    464         # something in self.user_ns, but before init_sys_modules, which
229    465         # is the first thing to modify sys.
230    466         # TODO: When we override sys.stdout and sys.stderr before this class
231    467         # is created, we are saving the overridden ones here. Not sure if this
232    468         # is what we want to do.
233    469         self.save_sys_module_state()
234    470         self.init_sys_modules()
235    471
236    472         # While we're trying to have each part of the code directly access what
237    473         # it needs without keeping redundant references to objects, we have too
238    474         # much legacy code that expects ip.db to exist.
239    475         self.db = PickleShareDB(os.path.join(self.profile_dir.location, 'db'))
240    476
241    477         self.init_history()
242    478         self.init_encoding()
243--> 479         self.init_prefilter()
244        self.init_prefilter = <bound method SageTerminalInteractiveShell.init_prefilter of <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f2494cf9f90>>
245    480
246    481         self.init_syntax_highlighting()
247    482         self.init_hooks()
248    483         self.init_events()
249    484         self.init_pushd_popd_magic()
250    485         self.init_user_ns()
251    486         self.init_logger()
252    487         self.init_builtins()
253    488
254    489         # The following was in post_config_initialization
255    490         self.init_inspector()
256    491         if py3compat.PY3:
257    492             self.raw_input_original = input
258    493         else:
259    494             self.raw_input_original = raw_input
260
261/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in init_prefilter(self=<sage.repl.interpreter.SageTerminalInteractiveShell object>)
262   2308         self.configurables.append(self.extension_manager)
263   2309
264   2310     #-------------------------------------------------------------------------
265   2311     # Things related to payloads
266   2312     #-------------------------------------------------------------------------
267   2313
268   2314     def init_payload(self):
269   2315         self.payload_manager = PayloadManager(parent=self)
270   2316         self.configurables.append(self.payload_manager)
271   2317     
272   2318     #-------------------------------------------------------------------------
273   2319     # Things related to the prefilter
274   2320     #-------------------------------------------------------------------------
275   2321
276   2322     def init_prefilter(self):
277-> 2323         self.prefilter_manager = PrefilterManager(shell=self, parent=self)
278        self.prefilter_manager = None
279        global PrefilterManager = <class 'IPython.core.prefilter.PrefilterManager'>
280        global shell = undefined
281        self = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f2494cf9f90>
282        global parent = undefined
283   2324         self.configurables.append(self.prefilter_manager)
284   2325         # Ultimately this will be refactored in the new interpreter code, but
285   2326         # for now, we should expose the main prefilter method (there's legacy
286   2327         # code out there that may rely on this).
287   2328         self.prefilter = self.prefilter_manager.prefilter_lines
288   2329
289   2330     def auto_rewrite_input(self, cmd):
290   2331         """Print to the screen the rewritten form of the user's command.
291   2332
292   2333         This shows visual feedback by rewriting input lines that cause
293   2334         automatic calling to kick in, like::
294   2335
295   2336           /f x
296   2337
297   2338         into::
298
299/usr/lib/python2.7/site-packages/IPython/core/prefilter.pyc in __init__(self=<IPython.core.prefilter.PrefilterManager object>, shell=<sage.repl.interpreter.SageTerminalInteractiveShell object>, **kwargs={'parent': <sage.repl.interpreter.SageTerminalInteractiveShell object>})
300    109     Both transformers and checkers also have `enabled` attribute, which is
301    110     a boolean that determines if the instance is used.
302    111
303    112     Users or developers can change the priority or enabled attribute of
304    113     transformers or checkers, but they must call the :meth:`sort_checkers`
305    114     or :meth:`sort_transformers` method after changing the priority.
306    115     """
307    116
308    117     multi_line_specials = Bool(True).tag(config=True)
309    118     shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
310    119
311    120     def __init__(self, shell=None, **kwargs):
312    121         super(PrefilterManager, self).__init__(shell=shell, **kwargs)
313    122         self.shell = shell
314    123         self.init_transformers()
315--> 124         self.init_handlers()
316        self.init_handlers = <bound method PrefilterManager.init_handlers of <IPython.core.prefilter.PrefilterManager object at 0x7f2494ca3650>>
317    125         self.init_checkers()
318    126
319    127     #-------------------------------------------------------------------------
320    128     # API for managing transformers
321    129     #-------------------------------------------------------------------------
322    130
323    131     def init_transformers(self):
324    132         """Create the default transformers."""
325    133         self._transformers = []
326    134         for transformer_cls in _default_transformers:
327    135             transformer_cls(
328    136                 shell=self.shell, prefilter_manager=self, parent=self
329    137             )
330    138
331    139     def sort_transformers(self):
332
333/usr/lib/python2.7/site-packages/IPython/core/prefilter.pyc in init_handlers(self=<IPython.core.prefilter.PrefilterManager object>)
334    194     def unregister_checker(self, checker):
335    195         """Unregister a checker instance."""
336    196         if checker in self._checkers:
337    197             self._checkers.remove(checker)
338    198
339    199     #-------------------------------------------------------------------------
340    200     # API for managing handlers
341    201     #-------------------------------------------------------------------------
342    202
343    203     def init_handlers(self):
344    204         """Create the default handlers."""
345    205         self._handlers = {}
346    206         self._esc_handlers = {}
347    207         for handler in _default_handlers:
348    208             handler(
349--> 209                 shell=self.shell, prefilter_manager=self, parent=self
350        global shell = undefined
351        self.shell = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f2494cf9f90>
352        global prefilter_manager = undefined
353        self = <IPython.core.prefilter.PrefilterManager object at 0x7f2494ca3650>
354        global parent = undefined
355    210             )
356    211
357    212     @property
358    213     def handlers(self):
359    214         """Return a dict of all the handlers."""
360    215         return self._handlers
361    216
362    217     def register_handler(self, name, handler, esc_strings):
363    218         """Register a handler instance by name with esc_strings."""
364    219         self._handlers[name] = handler
365    220         for esc_str in esc_strings:
366    221             self._esc_handlers[esc_str] = handler
367    222
368    223     def unregister_handler(self, name, handler, esc_strings):
369    224         """Unregister a handler instance by name with esc_strings."""
370
371/usr/lib/python2.7/site-packages/IPython/core/prefilter.pyc in __init__(self=<IPython.core.prefilter.PrefilterHandler object>, shell=<sage.repl.interpreter.SageTerminalInteractiveShell object>, prefilter_manager=<IPython.core.prefilter.PrefilterManager object>, **kwargs={'parent': <IPython.core.prefilter.PrefilterManager object>})
372    520
373    521 #-----------------------------------------------------------------------------
374    522 # Prefilter handlers
375    523 #-----------------------------------------------------------------------------
376    524
377    525
378    526 class PrefilterHandler(Configurable):
379    527
380    528     handler_name = Unicode('normal')
381    529     esc_strings = List([])
382    530     shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
383    531     prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)
384    532
385    533     def __init__(self, shell=None, prefilter_manager=None, **kwargs):
386    534         super(PrefilterHandler, self).__init__(
387--> 535             shell=shell, prefilter_manager=prefilter_manager, **kwargs
388        shell = <sage.repl.interpreter.SageTerminalInteractiveShell object at 0x7f2494cf9f90>
389        prefilter_manager = <IPython.core.prefilter.PrefilterManager object at 0x7f2494ca3650>
390        kwargs = {'parent': <IPython.core.prefilter.PrefilterManager object at 0x7f2494ca3650>}
391    536         )
392    537         self.prefilter_manager.register_handler(
393    538             self.handler_name,
394    539             self,
395    540             self.esc_strings
396    541         )
397    542
398    543     def handle(self, line_info):
399    544         # print "normal: ", line_info
400    545         """Handle normal input lines. Use as a template for handlers."""
401    546
402    547         # With autoindent on, we need some way to exit the input loop, and I
403    548         # don't want to force the user to have to backspace all the way to
404    549         # clear the line.  The rule will be in this case, that either two
405    550         # lines of pure whitespace in a row, or a line of pure whitespace but
406
407/usr/lib/python2.7/site-packages/traitlets/config/configurable.pyc in __init__(self=<IPython.core.prefilter.PrefilterHandler object>, **kwargs={'prefilter_manager': <IPython.core.prefilter.PrefilterManager object>, 'shell': <sage.repl.interpreter.SageTerminalInteractiveShell object>})
408     69
409     70         config = kwargs.pop('config', None)
410     71
411     72         # load kwarg traits, other than config
412     73         super(Configurable, self).__init__(**kwargs)
413     74
414     75         # load config
415     76         if config is not None:
416     77             # We used to deepcopy, but for now we are trying to just save
417     78             # by reference.  This *could* have side effects as all components
418     79             # will share config. In fact, I did find such a side effect in
419     80             # _config_changed below. If a config attribute value was a mutable type
420     81             # all instances of a component were getting the same copy, effectively
421     82             # making that a class attribute.
422     83             # self.config = deepcopy(config)
423---> 84             self.config = config
424        self.config = {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}
425        config = {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}
426     85         else:
427     86             # allow _config_default to return something
428     87             self._load_config(self.config)
429     88
430     89         # Ensure explicit kwargs are applied after loading config.
431     90         # This is usually redundant, but ensures config doesn't override
432     91         # explicitly assigned values.
433     92         for key, value in kwargs.items():
434     93             setattr(self, key, value)
435     94
436     95     #-------------------------------------------------------------------------
437     96     # Static trait notifiations
438     97     #-------------------------------------------------------------------------
439     98
440     99     @classmethod
441
442/usr/lib/python2.7/site-packages/traitlets/traitlets.pyc in __set__(self=<traitlets.traitlets.Instance object>, obj=<IPython.core.prefilter.PrefilterHandler object>, value={'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}})
443    570             silent = False
444    571         if silent is not True:
445    572             # we explicitly compare silent to True just in case the equality
446    573             # comparison above returns something other than True/False
447    574             obj._notify_trait(self.name, old_value, new_value)
448    575
449    576     def __set__(self, obj, value):
450    577         """Set the value of the trait by self.name for the instance.
451    578
452    579         Values pass through a validation stage where errors are raised when
453    580         impropper types, or types that cannot be coerced, are encountered.
454    581         """
455    582         if self.read_only:
456    583             raise TraitError('The "%s" trait is read-only.' % self.name)
457    584         else:
458--> 585             self.set(obj, value)
459        self.set = <bound method Instance.set of <traitlets.traitlets.Instance object at 0x7f2498c5af50>>
460        obj = <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>
461        value = {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}
462    586
463    587     def _validate(self, obj, value):
464    588         if value is None and self.allow_none:
465    589             return value
466    590         if hasattr(self, 'validate'):
467    591             value = self.validate(obj, value)
468    592         if obj._cross_validation_lock is False:
469    593             value = self._cross_validate(obj, value)
470    594         return value
471    595
472    596     def _cross_validate(self, obj, value):
473    597         if self.name in obj._trait_validators:
474    598             proposal = Bunch({'trait': self, 'value': value, 'owner': obj})
475    599             value = obj._trait_validators[self.name](obj, proposal)
476    600         elif hasattr(obj, '_%s_validate' % self.name):
477
478/usr/lib/python2.7/site-packages/traitlets/traitlets.pyc in set(self=<traitlets.traitlets.Instance object>, obj=<IPython.core.prefilter.PrefilterHandler object>, value={'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}})
479    559         new_value = self._validate(obj, value)
480    560         try:
481    561             old_value = obj._trait_values[self.name]
482    562         except KeyError:
483    563             old_value = self.default_value
484    564
485    565         obj._trait_values[self.name] = new_value
486    566         try:
487    567             silent = bool(old_value == new_value)
488    568         except:
489    569             # if there is an error in comparing, default to notify
490    570             silent = False
491    571         if silent is not True:
492    572             # we explicitly compare silent to True just in case the equality
493    573             # comparison above returns something other than True/False
494--> 574             obj._notify_trait(self.name, old_value, new_value)
495        obj._notify_trait = <bound method PrefilterHandler._notify_trait of <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>>
496        self.name = 'config'
497        old_value = traitlets.Undefined
498        new_value = {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}
499    575
500    576     def __set__(self, obj, value):
501    577         """Set the value of the trait by self.name for the instance.
502    578
503    579         Values pass through a validation stage where errors are raised when
504    580         impropper types, or types that cannot be coerced, are encountered.
505    581         """
506    582         if self.read_only:
507    583             raise TraitError('The "%s" trait is read-only.' % self.name)
508    584         else:
509    585             self.set(obj, value)
510    586
511    587     def _validate(self, obj, value):
512    588         if value is None and self.allow_none:
513    589             return value
514
515/usr/lib/python2.7/site-packages/traitlets/traitlets.pyc in _notify_trait(self=<IPython.core.prefilter.PrefilterHandler object>, name='config', old_value=traitlets.Undefined, new_value={'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}})
516   1124                 self._cross_validation_lock = False
517   1125                 # Restore method retrieval from class
518   1126                 del self.notify_change
519   1127
520   1128                 # trigger delayed notifications
521   1129                 for changes in cache.values():
522   1130                     for change in changes:
523   1131                         self.notify_change(change)
524   1132
525   1133     def _notify_trait(self, name, old_value, new_value):
526   1134         self.notify_change(Bunch(
527   1135             name=name,
528   1136             old=old_value,
529   1137             new=new_value,
530   1138             owner=self,
531-> 1139             type='change',
532        global type = undefined
533   1140         ))
534   1141
535   1142     def notify_change(self, change):
536   1143         if not isinstance(change, Bunch):
537   1144             # cast to bunch if given a dict
538   1145             change = Bunch(change)
539   1146         name, type = change.name, change.type
540   1147
541   1148         callables = []
542   1149         callables.extend(self._trait_notifiers.get(name, {}).get(type, []))
543   1150         callables.extend(self._trait_notifiers.get(name, {}).get(All, []))
544   1151         callables.extend(self._trait_notifiers.get(All, {}).get(type, []))
545   1152         callables.extend(self._trait_notifiers.get(All, {}).get(All, []))
546   1153
547   1154         # Now static ones
548
549/usr/lib/python2.7/site-packages/traitlets/traitlets.pyc in notify_change(self=<IPython.core.prefilter.PrefilterHandler object>, change={'owner': <IPython.core.prefilter.PrefilterHandl...ts.Undefined, 'name': 'config', 'type': 'change'})
550   1161                 cb = getattr(self, magic_name)
551   1162                 # Only append the magic method if it was not manually registered
552   1163                 if cb not in callables:
553   1164                     callables.append(_callback_wrapper(cb))
554   1165
555   1166         # Call them all now
556   1167         # Traits catches and logs errors here.  I allow them to raise
557   1168         for c in callables:
558   1169             # Bound methods have an additional 'self' argument.
559   1170
560   1171             if isinstance(c, _CallbackWrapper):
561   1172                 c = c.__call__
562   1173             elif isinstance(c, EventHandler) and c.name is not None:
563   1174                 c = getattr(self, c.name)
564   1175
565-> 1176             c(change)
566        c = <bound method ?.compatible_observer of <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>>
567        change = {'owner': <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>, 'new': {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}, 'old': traitlets.Undefined, 'name': 'config', 'type': 'change'}
568   1177
569   1178     def _add_notifiers(self, handler, name, type):
570   1179         if name not in self._trait_notifiers:
571   1180             nlist = []
572   1181             self._trait_notifiers[name] = {type: nlist}
573   1182         else:
574   1183             if type not in self._trait_notifiers[name]:
575   1184                 nlist = []
576   1185                 self._trait_notifiers[name][type] = nlist
577   1186             else:
578   1187                 nlist = self._trait_notifiers[name][type]
579   1188         if handler not in nlist:
580   1189             nlist.append(handler)
581   1190
582   1191     def _remove_notifiers(self, handler, name, type):
583
584/usr/lib/python2.7/site-packages/traitlets/traitlets.pyc in compatible_observer(self=<IPython.core.prefilter.PrefilterHandler object>, change_or_name={'owner': <IPython.core.prefilter.PrefilterHandl...ts.Undefined, 'name': 'config', 'type': 'change'}, old=traitlets.Undefined, new=traitlets.Undefined)
585    804     """
586    805     def compatible_observer(self, change_or_name, old=Undefined, new=Undefined):
587    806         if isinstance(change_or_name, dict):
588    807             change = change_or_name
589    808         else:
590    809             clsname = self.__class__.__name__
591    810             warn("A parent of %s._%s_changed has adopted the new (traitlets 4.1) @observe(change) API" % (
592    811                 clsname, change_or_name), DeprecationWarning)
593    812             change = Bunch(
594    813                 type='change',
595    814                 old=old,
596    815                 new=new,
597    816                 name=change_or_name,
598    817                 owner=self,
599    818             )
600--> 819         return func(self, change)
601        global func = undefined
602        self = <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>
603        change = {'owner': <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>, 'new': {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}, 'old': traitlets.Undefined, 'name': 'config', 'type': 'change'}
604    820     return compatible_observer
605    821
606    822
607    823 def validate(*names):
608    824     """A decorator to register cross validator of HasTraits object's state
609    825     when a Trait is set.
610    826
611    827     The handler passed to the decorator must have one ``proposal`` dict argument.
612    828     The proposal dictionary must hold the following keys:
613    829     * ``owner`` : the HasTraits instance
614    830     * ``value`` : the proposed value for the modified trait attribute
615    831     * ``trait`` : the TraitType instance associated with the attribute
616    832
617    833     Parameters
618    834     ----------
619
620/usr/lib/python2.7/site-packages/traitlets/config/configurable.pyc in _config_changed(self=<IPython.core.prefilter.PrefilterHandler object>, change={'owner': <IPython.core.prefilter.PrefilterHandl...ts.Undefined, 'name': 'config', 'type': 'change'})
621    171     @observe_compat
622    172     def _config_changed(self, change):
623    173         """Update all the class traits having ``config=True`` in metadata.
624    174
625    175         For any class trait with a ``config`` metadata attribute that is
626    176         ``True``, we update the trait with the value of the corresponding
627    177         config entry.
628    178         """
629    179         # Get all traits with a config metadata entry that is True
630    180         traits = self.traits(config=True)
631    181
632    182         # We auto-load config section for this class as well as any parent
633    183         # classes that are Configurable subclasses.  This starts with Configurable
634    184         # and works down the mro loading the config for each section.
635    185         section_names = self.section_names()
636--> 186         self._load_config(change.new, traits=traits, section_names=section_names)
637        self._load_config = <bound method PrefilterHandler._load_config of <IPython.core.prefilter.PrefilterHandler object at 0x7f2494ca3150>>
638        change.new = {'InteractiveShell': {'term_title': True, 'colors': 'LightBG', 'confirm_exit': False, 'prompts_class': <class 'sage.repl.prompts.SagePrompts'>, 'separate_in': '', 'ast_node_interactivity': 'all', 'simple_prompt': False}, 'InteractiveShellApp': {'extensions': ['sage']}, 'TerminalIPythonApp': {'shell_class': <class 'sage.repl.interpreter.SageTerminalInteractiveShell'>, 'display_banner': False, 'test_shell': False, 'verbose_crash': True}, 'SageTerminalApp': {'force_interact': True}}
639        traits = {}
640        section_names = ['Configurable', 'PrefilterHandler']
641    187
642    188     def update_config(self, config):
643    189         """Update config and load the new values"""
644    190         # traitlets prior to 4.2 created a copy of self.config in order to trigger change events.
645    191         # Some projects (IPython < 5) relied upon one side effect of this,
646    192         # that self.config prior to update_config was not modified in-place.
647    193         # For backward-compatibility, we must ensure that self.config
648    194         # is a new object and not modified in-place,
649    195         # but config consumers should not rely on this behavior.
650    196         self.config = deepcopy(self.config)
651    197         # load config
652    198         self._load_config(config)
653    199         # merge it into self.config
654    200         self.config.merge(config)
655    201         # TODO: trigger change event if/when dict-update change events take place
656
657/usr/lib/python2.7/site-packages/traitlets/config/configurable.pyc in _load_config(self=<IPython.core.prefilter.PrefilterHandler object>, cfg={'InteractiveShell': {'term_title': True, 'color...ue}, 'SageTerminalApp': {'force_interact': True}}, section_names=['Configurable', 'PrefilterHandler'], traits={})
658    153                     setattr(self, name, deepcopy(config_value))
659    154                 elif not _is_section_key(name) and not isinstance(config_value, Config):
660    155                     from difflib import get_close_matches
661    156                     if isinstance(self, LoggingConfigurable):
662    157                         warn = self.log.warning
663    158                     else:
664    159                         warn = lambda msg: warnings.warn(msg, stacklevel=9)
665    160                     matches = get_close_matches(name, traits)
666    161                     msg = u"Config option `{option}` not recognized by `{klass}`.".format(
667    162                         option=name, klass=self.__class__.__name__)
668    163
669    164                     if len(matches) == 1:
670    165                         msg += u"  Did you mean `{matches}`?".format(matches=matches[0])
671    166                     elif len(matches) >= 1:
672    167                         msg +="  Did you mean one of: `{matches}`?".format(matches=', '.join(sorted(matches)))
673--> 168                     warn(msg)
674        warn = undefined
675        msg = undefined
676    169
677    170     @observe('config')
678    171     @observe_compat
679    172     def _config_changed(self, change):
680    173         """Update all the class traits having ``config=True`` in metadata.
681    174
682    175         For any class trait with a ``config`` metadata attribute that is
683    176         ``True``, we update the trait with the value of the corresponding
684    177         config entry.
685    178         """
686    179         # Get all traits with a config metadata entry that is True
687    180         traits = self.traits(config=True)
688    181
689    182         # We auto-load config section for this class as well as any parent
690    183         # classes that are Configurable subclasses.  This starts with Configurable
691
692/usr/lib/python2.7/contextlib.pyc in __exit__(self=<contextlib.GeneratorContextManager object>, type=None, value=None, traceback=None)
693      9 class GeneratorContextManager(object):
694     10     """Helper for @contextmanager decorator."""
695     11
696     12     def __init__(self, gen):
697     13         self.gen = gen
698     14
699     15     def __enter__(self):
700     16         try:
701     17             return self.gen.next()
702     18         except StopIteration:
703     19             raise RuntimeError("generator didn't yield")
704     20
705     21     def __exit__(self, type, value, traceback):
706     22         if type is None:
707     23             try:
708---> 24                 self.gen.next()
709        self.gen.next = <method-wrapper 'next' of generator object at 0x7f2496463a50>
710     25             except StopIteration:
711     26                 return
712     27             else:
713     28                 raise RuntimeError("generator didn't stop")
714     29         else:
715     30             if value is None:
716     31                 # Need to force instantiation so we can reliably
717     32                 # tell if we get the same exception back
718     33                 value = type()
719     34             try:
720     35                 self.gen.throw(type, value, traceback)
721     36                 raise RuntimeError("generator didn't stop after throw()")
722     37             except StopIteration, exc:
723     38                 # Suppress the exception *unless* it's the same exception that
724     39                 # was passed to throw().  This prevents a StopIteration
725
726KeyboardInterrupt:
727
728***************************************************************************
729
730History of session input: