Bugzilla – Attachment 859433 Details for
Bug 1200228
ipython crash on tab completion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
ipython crash report
Crash_report_ipython.txt (text/plain), 44.31 KB, created by
Alexander Krupp
on 2022-06-04 09:21:40 UTC
(
hide
)
Description:
ipython crash report
Filename:
MIME Type:
Creator:
Alexander Krupp
Created:
2022-06-04 09:21:40 UTC
Size:
44.31 KB
patch
obsolete
>*************************************************************************** > >IPython post-mortem report > >{'commit_hash': '2486838d9', > 'commit_source': 'installation', > 'default_encoding': 'UTF-8', > 'ipython_path': '/usr/lib/python3.6/site-packages/IPython', > 'ipython_version': '7.16.1', > 'os_name': 'posix', > 'platform': 'Linux-5.14.21-150400.149.g82a1223-default-x86_64-with-glibc2.3.4', > 'sys_executable': '/usr/bin/python3', > 'sys_platform': 'linux', > 'sys_version': '3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]'} > >*************************************************************************** > > > >*************************************************************************** > >Crash traceback: > >--------------------------------------------------------------------------- >--------------------------------------------------------------------------- >ValueError Python 3.6.15: /usr/bin/python3 > Sat Jun 4 11:17:25 2022 >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/python3.6/site-packages/IPython/terminal/ptutils.py in get_completions(self=<IPython.terminal.ptutils.IPythonPTCompleter object>, document=Document('turtle.', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) > 114 try: >--> 115 yield from self._get_completions(body, offset, cursor_position, self.ipy_completer) > self._get_completions = <function IPythonPTCompleter._get_completions at 0x7f879d71cae8> > body = 'turtle.' > offset = 7 > cursor_position = 7 > self.ipy_completer = <IPython.core.completer.IPCompleter object at 0x7f879d3017b8> > 116 except Exception as e: > >/usr/lib/python3.6/site-packages/IPython/terminal/ptutils.py in _get_completions(body='turtle.', offset=7, cursor_position=7, ipyc=<IPython.core.completer.IPCompleter object>) > 127 body, ipyc.completions(body, offset)) >--> 128 for c in completions: > c = undefined > completions = <generator object _deduplicate_completions at 0x7f8799b5c5c8> > 129 if not c.text: > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in _deduplicate_completions(text='turtle.', completions=<generator object IPCompleter.completions>) > 437 """ >--> 438 completions = list(completions) > completions = <generator object IPCompleter.completions at 0x7f8799b5c570> > global list = undefined > 439 if not completions: > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in completions(self=<IPython.core.completer.IPCompleter object>, text='turtle.', offset=7) > 1817 try: >-> 1818 for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000): > c = undefined > self._completions = <bound method IPCompleter._completions of <IPython.core.completer.IPCompleter object at 0x7f879d3017b8>> > text = 'turtle.' > offset = 7 > global _timeout = undefined > self.jedi_compute_type_timeout = 400 > 1819 if c and (c in seen): > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in _completions(self=<IPython.core.completer.IPCompleter object>, full_text='turtle.', offset=7, _timeout=0.4) > 1874 if type_ == 'function': >-> 1875 signature = _make_signature(jm) > signature = undefined > global _make_signature = <function _make_signature at 0x7f879d7192f0> > jm = <Completion: addshape> > 1876 else: > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in _make_signature(completion=<Completion: addshape>) > 990 >--> 991 return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures() > global join = undefined > global f = undefined > global _formatparamchildren = <function _formatparamchildren at 0x7f879d719268> > global p = undefined > global signature = undefined > completion.get_signatures = <bound method BaseName.get_signatures of <Completion: addshape>> > global signature.defined_names = undefined > 992 for p in signature.defined_names()) if f]) > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in <listcomp>(.0=<generator object _make_signature.<locals>.<genexpr>>) > 990 >--> 991 return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures() > global join = undefined > f = undefined > global _formatparamchildren = <function _formatparamchildren at 0x7f879d719268> > global p = undefined > global signature = undefined > global completion.get_signatures = undefined > global signature.defined_names = undefined > 992 for p in signature.defined_names()) if f]) > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in <genexpr>(.0=<list_iterator object>) > 991 return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures() >--> 992 for p in signature.defined_names()) if f]) > p = <Name full_name='turtle.addshape.__gt__', description='instance __gt__'> > signature.defined_names = <bound method Name.defined_names of <BaseSignature full_name='turtle.addshape', description='def addshape'>> > global f = undefined > 993 > >/usr/lib/python3.6/site-packages/IPython/core/completer.py in _formatparamchildren(parameter=<Name full_name='turtle.addshape.__gt__', description='instance __gt__'>) > 968 raise ValueError('Jedi function parameter description have change format.' >--> 969 'Expected "param ...", found %r".' % description) > description = 'instance __gt__' > 970 return description[6:] > >ValueError: Jedi function parameter description have change format.Expected "param ...", found 'instance __gt__'". > >During handling of the above exception, another exception occurred: > >--------------------------------------------------------------------------- >AttributeError Python 3.6.15: /usr/bin/python3 > Sat Jun 4 11:17:25 2022 >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/bin/ipython in <module> > 1 #!/usr/bin/python3 > 2 # This script was automatically generated by setup.py > 3 if __name__ == '__main__': > 4 from IPython import start_ipython >----> 5 start_ipython() > global start_ipython = <function start_ipython at 0x7f879d2ef158> > >/usr/lib/python3.6/site-packages/IPython/__init__.py in start_ipython(argv=None, **kwargs={}) > 115 This is a public API method, and will survive implementation changes. > 116 > 117 Parameters > 118 ---------- > 119 > 120 argv : list or None, optional > 121 If unspecified or None, IPython will parse command-line options from sys.argv. > 122 To prevent any command-line parsing, pass an empty list: `argv=[]`. > 123 user_ns : dict, optional > 124 specify this dictionary to initialize the IPython user namespace with particular values. > 125 kwargs : various, optional > 126 Any other kwargs will be passed to the Application constructor, > 127 such as `config`. > 128 """ > 129 from IPython.terminal.ipapp import launch_new_instance >--> 130 return launch_new_instance(argv=argv, **kwargs) > launch_new_instance = <bound method Application.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>> > argv = None > kwargs = {} > 131 > 132 def start_kernel(argv=None, **kwargs): > 133 """Launch a normal IPython kernel instance (as opposed to embedded) > 134 > 135 `IPython.embed_kernel()` puts a shell in a particular calling scope, > 136 such as a function or method for debugging purposes, > 137 which is often not desirable. > 138 > 139 `start_kernel()` does full, regular IPython initialization, > 140 including loading startup files, configuration, etc. > 141 much of which is skipped by `embed()`. > 142 > 143 Parameters > 144 ---------- > 145 > >/usr/lib/python3.6/site-packages/traitlets/config/application.py in launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, **kwargs={}) > 649 lines.append(cls.class_config_section()) > 650 return '\n'.join(lines) > 651 > 652 def exit(self, exit_status=0): > 653 self.log.debug("Exiting application: %s" % self.name) > 654 sys.exit(exit_status) > 655 > 656 @classmethod > 657 def launch_instance(cls, argv=None, **kwargs): > 658 """Launch a global instance of this Application > 659 > 660 If a global instance already exists, this reinitializes and starts it > 661 """ > 662 app = cls.instance(**kwargs) > 663 app.initialize(argv) >--> 664 app.start() > app.start = <bound method TerminalIPythonApp.start of <IPython.terminal.ipapp.TerminalIPythonApp object at 0x7f87a3b74748>> > 665 > 666 #----------------------------------------------------------------------------- > 667 # utility functions, for convenience > 668 #----------------------------------------------------------------------------- > 669 > 670 def boolean_flag(name, configurable, set_help='', unset_help=''): > 671 """Helper for building basic --trait, --no-trait flags. > 672 > 673 Parameters > 674 ---------- > 675 > 676 name : str > 677 The name of the flag. > 678 configurable : str > 679 The 'Class.trait' string of the trait to be set/unset with the flag > >/usr/lib/python3.6/site-packages/IPython/terminal/ipapp.py in start(self=<IPython.terminal.ipapp.TerminalIPythonApp object>) > 341 if self.log_level <= logging.INFO: print() > 342 > 343 def _pylab_changed(self, name, old, new): > 344 """Replace --pylab='inline' with --pylab='auto'""" > 345 if new == 'inline': > 346 warnings.warn("'inline' not available as pylab backend, " > 347 "using 'auto' instead.") > 348 self.pylab = 'auto' > 349 > 350 def start(self): > 351 if self.subapp is not None: > 352 return self.subapp.start() > 353 # perform any prexec steps: > 354 if self.interact: > 355 self.log.debug("Starting IPython's mainloop...") >--> 356 self.shell.mainloop() > self.shell.mainloop = <bound method TerminalInteractiveShell.mainloop of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f879d306b38>> > 357 else: > 358 self.log.debug("IPython not interactive...") > 359 if not self.shell.last_execution_succeeded: > 360 sys.exit(1) > 361 > 362 def load_default_config(ipython_dir=None): > 363 """Load the default config file from the default ipython_dir. > 364 > 365 This is useful for embedded shells. > 366 """ > 367 if ipython_dir is None: > 368 ipython_dir = get_ipython_dir() > 369 > 370 profile_dir = os.path.join(ipython_dir, 'profile_default') > 371 app = TerminalIPythonApp() > >/usr/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in mainloop(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>) > 548 if (not self.confirm_exit) \ > 549 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): > 550 self.ask_exit() > 551 > 552 else: > 553 if code: > 554 self.run_cell(code, store_history=True) > 555 > 556 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): > 557 # An extra layer of protection in case someone mashing Ctrl-C breaks > 558 # out of our internal code. > 559 if display_banner is not DISPLAY_BANNER_DEPRECATED: > 560 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) > 561 while True: > 562 try: >--> 563 self.interact() > self.interact = <bound method TerminalInteractiveShell.interact of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f879d306b38>> > 564 break > 565 except KeyboardInterrupt as e: > 566 print("\n%s escaped interact()\n" % type(e).__name__) > 567 finally: > 568 # An interrupt during the eventloop will mess up the > 569 # internal state of the prompt_toolkit library. > 570 # Stopping the eventloop fixes this, see > 571 # https://github.com/ipython/ipython/pull/9867 > 572 if hasattr(self, '_eventloop'): > 573 self._eventloop.stop() > 574 > 575 self.restore_term_title() > 576 > 577 > 578 _inputhook = None > >/usr/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in interact(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>, display_banner=<object object>) > 531 def ask_exit(self): > 532 self.keep_running = False > 533 > 534 rl_next_input = None > 535 > 536 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED): > 537 > 538 if display_banner is not DISPLAY_BANNER_DEPRECATED: > 539 warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) > 540 > 541 self.keep_running = True > 542 while self.keep_running: > 543 print(self.separate_in, end='') > 544 > 545 try: >--> 546 code = self.prompt_for_code() > code = 'import turtle' > self.prompt_for_code = <bound method TerminalInteractiveShell.prompt_for_code of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f879d306b38>> > 547 except EOFError: > 548 if (not self.confirm_exit) \ > 549 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): > 550 self.ask_exit() > 551 > 552 else: > 553 if code: > 554 self.run_cell(code, store_history=True) > 555 > 556 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED): > 557 # An extra layer of protection in case someone mashing Ctrl-C breaks > 558 # out of our internal code. > 559 if display_banner is not DISPLAY_BANNER_DEPRECATED: > 560 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) > 561 while True: > >/usr/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py in prompt_for_code(self=<IPython.terminal.interactiveshell.TerminalInteractiveShell object>) > 459 # prompt in a different event loop. > 460 # If we don't do this, people could spawn coroutine with a > 461 # while/true inside which will freeze the prompt. > 462 > 463 try: > 464 old_loop = asyncio.get_event_loop() > 465 except RuntimeError: > 466 # This happens when the user used `asyncio.run()`. > 467 old_loop = None > 468 > 469 asyncio.set_event_loop(self.pt_loop) > 470 try: > 471 with patch_stdout(raw=True): > 472 text = self.pt_app.prompt( > 473 default=default, >--> 474 **self._extra_prompt_options()) > self._extra_prompt_options = <bound method TerminalInteractiveShell._extra_prompt_options of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x7f879d306b38>> > 475 finally: > 476 # Restore the original event loop. > 477 asyncio.set_event_loop(old_loop) > 478 > 479 return text > 480 > 481 def enable_win_unicode_console(self): > 482 # Since IPython 7.10 doesn't support python < 3.6 and PEP 528, Python uses the unicode APIs for the Windows > 483 # console by default, so WUC shouldn't be needed. > 484 from warnings import warn > 485 warn("`enable_win_unicode_console` is deprecated since IPython 7.10, does not do anything and will be removed in the future", > 486 DeprecationWarning, > 487 stacklevel=2) > 488 > 489 def init_io(self): > >/usr/lib/python3.6/site-packages/prompt_toolkit/shortcuts/prompt.py in prompt(self=<prompt_toolkit.shortcuts.prompt.PromptSession object>, message=<prompt_toolkit.formatted_text.pygments.PygmentsTokens object>, editing_mode=None, refresh_interval=None, vi_mode=None, lexer=<IPython.terminal.ptutils.IPythonPTLexer object>, completer=None, complete_in_thread=False, is_password=None, key_bindings=None, bottom_toolbar=None, style=None, color_depth=None, include_default_pygments_style=None, style_transformation=None, swap_light_and_dark_colors=None, rprompt=None, multiline=True, prompt_continuation=<function TerminalInteractiveShell._extra_prompt_options.<locals>.<lambda>>, wrap_lines=None, enable_history_search=None, search_ignore_case=None, complete_while_typing=None, validate_while_typing=None, complete_style=<CompleteStyle.MULTI_COLUMN: 'MULTI_COLUMN'>, auto_suggest=None, validator=None, clipboard=None, mouse_support=None, input_processors=[ConditionalProcessor(processor=<prompt_toolkit.l...pt_options.<locals>.<lambda> at 0x7f879c849950>))], placeholder=None, reserve_space_for_menu=6, enable_system_prompt=None, enable_suspend=None, enable_open_in_editor=None, tempfile_suffix=None, tempfile=None, default='', accept_default=False, pre_run=None, set_exception_handler=True) > 998 self.tempfile_suffix = tempfile_suffix > 999 if tempfile is not None: > 1000 self.tempfile = tempfile > 1001 > 1002 self._add_pre_run_callables(pre_run, accept_default) > 1003 self.default_buffer.reset( > 1004 default if isinstance(default, Document) else Document(default) > 1005 ) > 1006 self.app.refresh_interval = self.refresh_interval # This is not reactive. > 1007 > 1008 # If we are using the default output, and have a dumb terminal. Use the > 1009 # dumb prompt. > 1010 if self._output is None and is_dumb_terminal(): > 1011 return get_event_loop().run_until_complete(self._dumb_prompt(self.message)) > 1012 >-> 1013 return self.app.run(set_exception_handler=set_exception_handler) > self.app.run = <bound method Application.run of <prompt_toolkit.application.application.Application object at 0x7f879c91f668>> > set_exception_handler = True > 1014 > 1015 async def _dumb_prompt(self, message: AnyFormattedText = "") -> _T: > 1016 """ > 1017 Prompt function for dumb terminals. > 1018 > 1019 Dumb terminals have minimum rendering capabilities. We can only print > 1020 text to the screen. We can't use colors, and we can't do cursor > 1021 movements. The Emacs inferior shell is an example of a dumb terminal. > 1022 > 1023 We will show the prompt, and wait for the input. We still handle arrow > 1024 keys, and all custom key bindings, but we don't really render the > 1025 cursor movements. Instead we only print the typed character that's > 1026 right before the cursor. > 1027 """ > 1028 # Send prompt to output. > >/usr/lib/python3.6/site-packages/prompt_toolkit/application/application.py in run(self=<prompt_toolkit.application.application.Application object>, pre_run=None, set_exception_handler=True) > 802 # We don't create a new event loop by default, because we want to be > 803 # sure that when this is called multiple times, each call of `run()` > 804 # goes through the same event loop. This way, users can schedule > 805 # background-tasks that keep running across multiple prompts. > 806 try: > 807 loop = get_event_loop() > 808 except RuntimeError: > 809 # Possibly we are not running in the main thread, where no event > 810 # loop is set by default. Or somebody called `asyncio.run()` > 811 # before, which closes the existing event loop. We can create a new > 812 # loop. > 813 loop = new_event_loop() > 814 set_event_loop(loop) > 815 > 816 return loop.run_until_complete( >--> 817 self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler) > self.run_async = <bound method Application.run_async of <prompt_toolkit.application.application.Application object at 0x7f879c91f668>> > pre_run = None > set_exception_handler = True > 818 ) > 819 > 820 def _handle_exception( > 821 self, loop: AbstractEventLoop, context: Dict[str, Any] > 822 ) -> None: > 823 """ > 824 Handler for event loop exceptions. > 825 This will print the exception, using run_in_terminal. > 826 """ > 827 # For Python 2: we have to get traceback at this point, because > 828 # we're still in the 'except:' block of the event loop where the > 829 # traceback is still available. Moving this code in the > 830 # 'print_exception' coroutine will loose the exception. > 831 tb = get_traceback_from_context(context) > 832 formatted_tb = "".join(format_tb(tb)) > >/usr/lib64/python3.6/asyncio/base_events.py in run_until_complete(self=<_UnixSelectorEventLoop running=False closed=False debug=False>, future=<Task finished coro=<Application.run_async() don...alueError' object has no attribute 'tb_frame'",)>) > 473 future.add_done_callback(_run_until_complete_cb) > 474 try: > 475 self.run_forever() > 476 except: > 477 if new_task and future.done() and not future.cancelled(): > 478 # The coroutine raised a BaseException. Consume the exception > 479 # to not log a warning, the caller doesn't have access to the > 480 # local task. > 481 future.exception() > 482 raise > 483 finally: > 484 future.remove_done_callback(_run_until_complete_cb) > 485 if not future.done(): > 486 raise RuntimeError('Event loop stopped before Future completed.') > 487 >--> 488 return future.result() > future.result = <built-in method result of _asyncio.Task object at 0x7f879c849ae8> > 489 > 490 def stop(self): > 491 """Stop running the event loop. > 492 > 493 Every callback already scheduled will still run. This simply informs > 494 run_forever to stop looping after a complete iteration. > 495 """ > 496 self._stopping = True > 497 > 498 def close(self): > 499 """Close the event loop. > 500 > 501 This clears the queues and shuts down the executor, > 502 but does not wait for the executor to finish. > 503 > >/usr/lib/python3.6/site-packages/prompt_toolkit/application/application.py in run_async(self=<prompt_toolkit.application.application.Application object>, pre_run=None, set_exception_handler=True) > 768 # go in the finally! If `_run_async` raises > 769 # `KeyboardInterrupt`, we still want to wait for the > 770 # background tasks. > 771 await self.cancel_and_wait_for_background_tasks() > 772 > 773 # Set the `_is_running` flag to `False`. Normally this > 774 # happened already in the finally block in `run_async` > 775 # above, but in case of exceptions, that's not always the > 776 # case. > 777 self._is_running = False > 778 return result > 779 finally: > 780 if set_exception_handler: > 781 loop.set_exception_handler(previous_exc_handler) > 782 >--> 783 return await _run_async2() > global await = undefined > _run_async2 = <function Application.run_async.<locals>._run_async2 at 0x7f879c0f9620> > 784 > 785 def run( > 786 self, > 787 pre_run: Optional[Callable[[], None]] = None, > 788 set_exception_handler: bool = True, > 789 ) -> _AppResult: > 790 """ > 791 A blocking 'run' call that waits until the UI is finished. > 792 > 793 This will start the current asyncio event loop. If no loop is set for > 794 the current thread, then it will create a new loop. > 795 > 796 :param pre_run: Optional callable, which is called right after the > 797 "reset" of the application. > 798 :param set_exception_handler: When set, in case of an exception, go out > >/usr/lib/python3.6/site-packages/prompt_toolkit/application/application.py in _run_async2() > 756 > 757 loop = get_event_loop() > 758 if set_exception_handler: > 759 previous_exc_handler = loop.get_exception_handler() > 760 loop.set_exception_handler(self._handle_exception) > 761 > 762 try: > 763 with set_app(self): > 764 try: > 765 result = await _run_async() > 766 finally: > 767 # Wait for the background tasks to be done. This needs to > 768 # go in the finally! If `_run_async` raises > 769 # `KeyboardInterrupt`, we still want to wait for the > 770 # background tasks. >--> 771 await self.cancel_and_wait_for_background_tasks() > global await = undefined > global self.cancel_and_wait_for_background_tasks = undefined > 772 > 773 # Set the `_is_running` flag to `False`. Normally this > 774 # happened already in the finally block in `run_async` > 775 # above, but in case of exceptions, that's not always the > 776 # case. > 777 self._is_running = False > 778 return result > 779 finally: > 780 if set_exception_handler: > 781 loop.set_exception_handler(previous_exc_handler) > 782 > 783 return await _run_async2() > 784 > 785 def run( > 786 self, > >/usr/lib/python3.6/site-packages/prompt_toolkit/application/application.py in cancel_and_wait_for_background_tasks(self=<prompt_toolkit.application.application.Application object>) > 857 > 858 async def cancel_and_wait_for_background_tasks(self) -> None: > 859 """ > 860 Cancel all background tasks, and wait for the cancellation to be done. > 861 If any of the background tasks raised an exception, this will also > 862 propagate the exception. > 863 > 864 (If we had nurseries like Trio, this would be the `__aexit__` of a > 865 nursery.) > 866 """ > 867 for task in self.background_tasks: > 868 task.cancel() > 869 > 870 for task in self.background_tasks: > 871 try: >--> 872 await task > global await = undefined > task = <Task finished coro=<Buffer._create_completer_coroutine.<locals>.async_completer() done, defined at /usr/lib/python3.6/site-packages/prompt_toolkit/buffer.py:1841> exception=AttributeError("'ValueError' object has no attribute 'tb_frame'",)> > 873 except CancelledError: > 874 pass > 875 > 876 def cpr_not_supported_callback(self) -> None: > 877 """ > 878 Called when we don't receive the cursor position response in time. > 879 """ > 880 if not self.output.responds_to_cpr: > 881 return # We know about this already. > 882 > 883 def in_terminal() -> None: > 884 self.output.write( > 885 "WARNING: your terminal doesn't support cursor position requests (CPR).\r\n" > 886 ) > 887 self.output.flush() > >/usr/lib/python3.6/site-packages/prompt_toolkit/buffer.py in new_coroutine(*a=(), **kw={'complete_event': CompleteEvent(text_inserted=False, completion_requested=True), 'insert_common_part': True, 'select_first': False, 'select_last': False}) > 1839 running = False > 1840 > 1841 @wraps(coroutine) > 1842 async def new_coroutine(*a: Any, **kw: Any) -> Any: > 1843 nonlocal running > 1844 > 1845 # Don't start a new function, if the previous is still in progress. > 1846 if running: > 1847 return > 1848 > 1849 running = True > 1850 > 1851 try: > 1852 while True: > 1853 try: >-> 1854 await coroutine(*a, **kw) > global await = undefined > global coroutine = undefined > a = () > kw = {'select_first': False, 'select_last': False, 'insert_common_part': True, 'complete_event': CompleteEvent(text_inserted=False, completion_requested=True)} > 1855 except _Retry: > 1856 continue > 1857 else: > 1858 return None > 1859 finally: > 1860 running = False > 1861 > 1862 return cast(_T, new_coroutine) > 1863 > 1864 > 1865 class _Retry(Exception): > 1866 " Retry in `_only_one_at_a_time`. " > 1867 > 1868 > 1869 def indent(buffer: Buffer, from_row: int, to_row: int, count: int = 1) -> None: > >/usr/lib/python3.6/site-packages/prompt_toolkit/buffer.py in async_completer(select_first=False, select_last=False, insert_common_part=True, complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) > 1669 > 1670 # Don't complete when we already have completions. > 1671 if self.complete_state or not self.completer: > 1672 return > 1673 > 1674 # Create an empty CompletionState. > 1675 complete_state = CompletionState(original_document=self.document) > 1676 self.complete_state = complete_state > 1677 > 1678 def proceed() -> bool: > 1679 """Keep retrieving completions. Input text has not yet changed > 1680 while generating completions.""" > 1681 return self.complete_state == complete_state > 1682 > 1683 async for completion in self.completer.get_completions_async( >-> 1684 document, complete_event > document = Document('turtle.', 7) > complete_event = CompleteEvent(text_inserted=False, completion_requested=True) > 1685 ): > 1686 complete_state.completions.append(completion) > 1687 self.on_completions_changed.fire() > 1688 > 1689 # If the input text changes, abort. > 1690 if not proceed(): > 1691 break > 1692 > 1693 completions = complete_state.completions > 1694 > 1695 # When there is only one completion, which has nothing to add, ignore it. > 1696 if len(completions) == 1 and completion_does_nothing( > 1697 document, completions[0] > 1698 ): > 1699 del completions[:] > >/usr/lib/python3.6/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self=DynamicCompleter(<function PromptSession._create...ils.IPythonPTCompleter object at 0x7f879cad75f8>), document=Document('turtle.', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) > 255 def __init__(self, get_completer: Callable[[], Optional[Completer]]) -> None: > 256 self.get_completer = get_completer > 257 > 258 def get_completions( > 259 self, document: Document, complete_event: CompleteEvent > 260 ) -> Iterable[Completion]: > 261 completer = self.get_completer() or DummyCompleter() > 262 return completer.get_completions(document, complete_event) > 263 > 264 async def get_completions_async( > 265 self, document: Document, complete_event: CompleteEvent > 266 ) -> AsyncGenerator[Completion, None]: > 267 completer = self.get_completer() or DummyCompleter() > 268 > 269 async for completion in completer.get_completions_async( >--> 270 document, complete_event > document = Document('turtle.', 7) > complete_event = CompleteEvent(text_inserted=False, completion_requested=True) > 271 ): > 272 yield completion > 273 > 274 def __repr__(self) -> str: > 275 return "DynamicCompleter(%r -> %r)" % (self.get_completer, self.get_completer()) > 276 > 277 > 278 class _MergedCompleter(Completer): > 279 """ > 280 Combine several completers into one. > 281 """ > 282 > 283 def __init__(self, completers: Sequence[Completer]) -> None: > 284 self.completers = completers > 285 > >/usr/lib/python3.6/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self=<IPython.terminal.ptutils.IPythonPTCompleter object>, document=Document('turtle.', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) > 181 :param document: :class:`~prompt_toolkit.document.Document` instance. > 182 :param complete_event: :class:`.CompleteEvent` instance. > 183 """ > 184 while False: > 185 yield > 186 > 187 async def get_completions_async( > 188 self, document: Document, complete_event: CompleteEvent > 189 ) -> AsyncGenerator[Completion, None]: > 190 """ > 191 Asynchronous generator for completions. (Probably, you won't have to > 192 override this.) > 193 > 194 Asynchronous generator of :class:`.Completion` objects. > 195 """ >--> 196 for item in self.get_completions(document, complete_event): > item = undefined > self.get_completions = <bound method IPythonPTCompleter.get_completions of <IPython.terminal.ptutils.IPythonPTCompleter object at 0x7f879cad75f8>> > document = Document('turtle.', 7) > complete_event = CompleteEvent(text_inserted=False, completion_requested=True) > 197 yield item > 198 > 199 > 200 class ThreadedCompleter(Completer): > 201 """ > 202 Wrapper that runs the `get_completions` generator in a thread. > 203 > 204 (Use this to prevent the user interface from becoming unresponsive if the > 205 generation of completions takes too much time.) > 206 > 207 The completions will be displayed as soon as they are produced. The user > 208 can already select a completion, even if not all completions are displayed. > 209 """ > 210 > 211 def __init__(self, completer: Completer) -> None: > >/usr/lib/python3.6/site-packages/IPython/terminal/ptutils.py in get_completions(self=<IPython.terminal.ptutils.IPythonPTCompleter object>, document=Document('turtle.', 7), complete_event=CompleteEvent(text_inserted=False, completion_requested=True)) > 103 return > 104 # Some bits of our completion system may print stuff (e.g. if a module > 105 # is imported). This context manager ensures that doesn't interfere with > 106 # the prompt. > 107 > 108 with patch_stdout(), provisionalcompleter(): > 109 body = document.text > 110 cursor_row = document.cursor_position_row > 111 cursor_col = document.cursor_position_col > 112 cursor_position = document.cursor_position > 113 offset = cursor_to_position(body, cursor_row, cursor_col) > 114 try: > 115 yield from self._get_completions(body, offset, cursor_position, self.ipy_completer) > 116 except Exception as e: > 117 from traceback import print_tb >--> 118 print_tb(e) > print_tb = <function print_tb at 0x7f87a37c0268> > e = undefined > 119 > 120 @staticmethod > 121 def _get_completions(body, offset, cursor_position, ipyc): > 122 """ > 123 Private equivalent of get_completions() use only for unit_testing. > 124 """ > 125 debug = getattr(ipyc, 'debug', False) > 126 completions = _deduplicate_completions( > 127 body, ipyc.completions(body, offset)) > 128 for c in completions: > 129 if not c.text: > 130 # Guard against completion machinery giving us an empty string. > 131 continue > 132 text = unicodedata.normalize('NFC', c.text) > 133 # When the first character of the completion has a zero length, > >/usr/lib64/python3.6/traceback.py in print_tb(tb=ValueError('Jedi function parameter description ...ected "param ...", found \'instance __gt__\'".',), limit=None, file=None) > 38 """ > 39 return StackSummary.from_list(extracted_list).format() > 40 > 41 # > 42 # Printing and Extracting Tracebacks. > 43 # > 44 > 45 def print_tb(tb, limit=None, file=None): > 46 """Print up to 'limit' stack trace entries from the traceback 'tb'. > 47 > 48 If 'limit' is omitted or None, all entries are printed. If 'file' > 49 is omitted or None, the output goes to sys.stderr; otherwise > 50 'file' should be an open file or file-like object with a write() > 51 method. > 52 """ >---> 53 print_list(extract_tb(tb, limit=limit), file=file) > global print_list = <function print_list at 0x7f87a37fca60> > global extract_tb = <function extract_tb at 0x7f87a37c0378> > tb = ValueError('Jedi function parameter description have change format.Expected "param ...", found \'instance __gt__\'".',) > limit = None > file = None > 54 > 55 def format_tb(tb, limit=None): > 56 """A shorthand for 'format_list(extract_tb(tb, limit))'.""" > 57 return extract_tb(tb, limit=limit).format() > 58 > 59 def extract_tb(tb, limit=None): > 60 """ > 61 Return a StackSummary object representing a list of > 62 pre-processed entries from traceback. > 63 > 64 This is useful for alternate formatting of stack traces. If > 65 'limit' is omitted or None, all entries are extracted. A > 66 pre-processed stack trace entry is a FrameSummary object > 67 containing attributes filename, lineno, name, and line > 68 representing the information that is usually printed for a stack > >/usr/lib64/python3.6/traceback.py in extract_tb(tb=ValueError('Jedi function parameter description ...ected "param ...", found \'instance __gt__\'".',), limit=None) > 57 return extract_tb(tb, limit=limit).format() > 58 > 59 def extract_tb(tb, limit=None): > 60 """ > 61 Return a StackSummary object representing a list of > 62 pre-processed entries from traceback. > 63 > 64 This is useful for alternate formatting of stack traces. If > 65 'limit' is omitted or None, all entries are extracted. A > 66 pre-processed stack trace entry is a FrameSummary object > 67 containing attributes filename, lineno, name, and line > 68 representing the information that is usually printed for a stack > 69 trace. The line is a string with leading and trailing > 70 whitespace stripped; if the source is not available it is None. > 71 """ >---> 72 return StackSummary.extract(walk_tb(tb), limit=limit) > global StackSummary.extract = <bound method StackSummary.extract of <class 'traceback.StackSummary'>> > global walk_tb = <function walk_tb at 0x7f87a37c0e18> > tb = ValueError('Jedi function parameter description have change format.Expected "param ...", found \'instance __gt__\'".',) > limit = None > 73 > 74 # > 75 # Exception formatting and output. > 76 # > 77 > 78 _cause_message = ( > 79 "\nThe above exception was the direct cause " > 80 "of the following exception:\n\n") > 81 > 82 _context_message = ( > 83 "\nDuring handling of the above exception, " > 84 "another exception occurred:\n\n") > 85 > 86 > 87 def print_exception(etype, value, tb, limit=None, file=None, chain=True): > >/usr/lib64/python3.6/traceback.py in extract(klass=<class 'traceback.StackSummary'>, frame_gen=<generator object walk_tb>, limit=None, lookup_lines=True, capture_locals=False) > 330 :param capture_locals: If True, the local variables from each frame will > 331 be captured as object representations into the FrameSummary. > 332 """ > 333 if limit is None: > 334 limit = getattr(sys, 'tracebacklimit', None) > 335 if limit is not None and limit < 0: > 336 limit = 0 > 337 if limit is not None: > 338 if limit >= 0: > 339 frame_gen = itertools.islice(frame_gen, limit) > 340 else: > 341 frame_gen = collections.deque(frame_gen, maxlen=-limit) > 342 > 343 result = klass() > 344 fnames = set() >--> 345 for f, lineno in frame_gen: > f = undefined > lineno = undefined > frame_gen = <generator object walk_tb at 0x7f8799b5c518> > 346 co = f.f_code > 347 filename = co.co_filename > 348 name = co.co_name > 349 > 350 fnames.add(filename) > 351 linecache.lazycache(filename, f.f_globals) > 352 # Must defer line lookups until we have called checkcache. > 353 if capture_locals: > 354 f_locals = f.f_locals > 355 else: > 356 f_locals = None > 357 result.append(FrameSummary( > 358 filename, lineno, name, lookup_line=False, locals=f_locals)) > 359 for filename in fnames: > 360 linecache.checkcache(filename) > >/usr/lib64/python3.6/traceback.py in walk_tb(tb=ValueError('Jedi function parameter description ...ected "param ...", found \'instance __gt__\'".',)) > 295 """ > 296 if f is None: > 297 f = sys._getframe().f_back.f_back > 298 while f is not None: > 299 yield f, f.f_lineno > 300 f = f.f_back > 301 > 302 > 303 def walk_tb(tb): > 304 """Walk a traceback yielding the frame and line number for each frame. > 305 > 306 This will follow tb.tb_next (and thus is in the opposite order to > 307 walk_stack). Usually used with StackSummary.extract. > 308 """ > 309 while tb is not None: >--> 310 yield tb.tb_frame, tb.tb_lineno > tb.tb_frame = undefined > tb.tb_lineno = undefined > 311 tb = tb.tb_next > 312 > 313 > 314 _RECURSIVE_CUTOFF = 3 # Also hardcoded in traceback.c. > 315 > 316 class StackSummary(list): > 317 """A stack of frames.""" > 318 > 319 @classmethod > 320 def extract(klass, frame_gen, *, limit=None, lookup_lines=True, > 321 capture_locals=False): > 322 """Create a StackSummary from a traceback or stack object. > 323 > 324 :param frame_gen: A generator that yields (frame, lineno) tuples to > 325 include in the stack. > >AttributeError: 'ValueError' object has no attribute 'tb_frame' > >*************************************************************************** > >History of session input:get_ipython().run_line_magic('config', 'Application.verbose_crash=True')import turtle >*** Last line of input (may not be in above history): >import turtle
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 1200228
: 859433 |
859555