Title: Prompt broken when launching `bpython.embed()` from ipdb · Issue #907 · bpython/bpython · GitHub
Open Graph Title: Prompt broken when launching `bpython.embed()` from ipdb · Issue #907 · bpython/bpython
X Title: Prompt broken when launching `bpython.embed()` from ipdb · Issue #907 · bpython/bpython
Description: Description BPython prompt breaks when executing .embed() from ipdb context. New lines are not shown after input, prompt text is altered by IPython and not reset by bpython, dict outputs do not show, and with long dict the prompt is repe...
Open Graph Description: Description BPython prompt breaks when executing .embed() from ipdb context. New lines are not shown after input, prompt text is altered by IPython and not reset by bpython, dict outputs do not sho...
X Description: Description BPython prompt breaks when executing .embed() from ipdb context. New lines are not shown after input, prompt text is altered by IPython and not reset by bpython, dict outputs do not sho...
Opengraph URL: https://github.com/bpython/bpython/issues/907
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Prompt broken when launching `bpython.embed()` from ipdb","articleBody":"## Description\r\nBPython prompt breaks when executing `.embed()` from ipdb context.\r\nNew lines are not shown after input, prompt text is altered by IPython and not reset by bpython, dict outputs do not show, and with long dict the prompt is repeated after the actual data.\r\n\r\nPossible fix would be to reset readline and Python repl settings when entering embedded bpython.\r\nVersions:\r\n```sh\r\n$ python -c 'print(__import__(\"bpython\").__version__)'\r\n0.21\r\n$ python -c 'print(__import__(\"IPython\").__version__)'\r\n7.26.0\r\n```\r\n\r\n## Steps to reproduce\r\n```sh\r\n$ python -c 'from IPython.terminal.debugger import set_trace; set_trace()'\r\n--Return--\r\nNone\r\n> \u003cstring>(1)\u003cmodule>()\r\n\r\nipdb> import bpython; bpython.embed()\r\n\r\nIn : # When short text is typed, no newline is printed\r\nIn : # Next line wriitten input is `123`\r\nIn : 123123\r\nIn : # Dicts get cut off when cursor is at last character\r\nIn : # Next line input is `{'foo': 'bar'}\u003cENTER>`\r\nIn : {'foo': 'bar'{'foo': 'bar'}\r\nIn : # With long dicts the output is placed without newline and the prompt repeated after the output without new line and some text is cut off at the end.\r\nIn : # Next line `locals()` is inputted and enter pressed.\r\nIn : locals(){'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': None, '__spec__': None, '__builtins__': {'__name__': 'builtins', '__doc__': \"Built-in functions, exceptions, and other objects.\\n\\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.\", '__package__': '', '__loader__': \u003cclass '_frozen_importlib.BuiltinImporter'>, '__spec__': ModuleSpec(name='builtins', loader=\u003cclass '_frozen_importlib.BuiltinImporter'>, origin='built-in'), '__build_class__': \u003cbuilt-in function __build_class__>, '__import__': \u003cbuilt-in function __import__>, 'abs': \u003cbuilt-in function abs>, 'all': \u003cbuilt-in function all>, 'any': \u003cbuilt-in function any>, 'ascii': \u003cbuilt-in function ascii>, 'bin': \u003cbuilt-in function bin>, 'breakpoint': \u003cbuilt-in function breakpoint>, 'callable': \u003cbuilt-in function callable>, 'chr': \u003cbuilt-in function chr>, 'compile': \u003cbuilt-in function compile>, 'delattr': \u003cbuilt-in function delattr>, 'dir': \u003cbuilt-in function dir>, 'divmod': \u003cbuilt-in function divmod>, 'eval': \u003cbuilt-in function eval>, 'exec': \u003cbuilt-in function exec>, 'format': \u003cbuilt-in function format>, 'getattr': \u003cbuilt-in function getattr>, 'globals': \u003cbuilt-in function globals>, 'hasattr': \u003cbuilt-in function hasattr>, 'hash': \u003cbuilt-in function hash>, 'hex': \u003cbuilt-in function hex>, 'id': \u003cbuilt-in function id>, 'input': \u003cbuilt-in function input>, 'isinstance': \u003cbuilt-in function isinstance>, 'issubclass': \u003cbuilt-in function issubclass>, 'iter': \u003cbuilt-in function iter>, 'len': \u003cbuilt-in function len>, 'locals': \u003cbuilt-in function locals>, 'max': \u003cbuilt-in function max>, 'min': \u003cbuilt-in function min>, 'next': \u003cbuilt-in function next>, 'oct': \u003cbuilt-in function oct>, 'ord': \u003cbuilt-in function ord>, 'pow': \u003cbuilt-in function pow>, 'print': \u003cbuilt-in function print>, 'repr': \u003cbuilt-in function repr>, 'round': \u003cbuilt-in function round>, 'setattr': \u003cbuilt-in function setattr>, 'sorted': \u003cbuilt-in function sorted>, 'sum': \u003cbuilt-in function sum>, 'vars': \u003cbuilt-in function vars>, 'None': None, 'Ellipsis': Ellipsis, 'NotImplemented': NotImplemented, 'False': False, 'True': True, 'bool': \u003cclass 'bool'>, 'memoryview': \u003cclass 'memoryview'>, 'bytearray': \u003cclass 'bytearray'>, 'bytes': \u003cclass 'bytes'>, 'classmethod': \u003cclass 'classmethod'>, 'complex': \u003cclass 'complex'>, 'dict': \u003cclass 'dict'>, 'enumerate': \u003cclass 'enumerate'>, 'filter': \u003cclass 'filter'>, 'float': \u003cclass 'float'>, 'frozenset': \u003cclass 'frozenset'>, 'property': \u003cclass 'property'>, 'int': \u003cclass 'int'>, 'list': \u003cclass 'list'>, 'map': \u003cclass 'map'>, 'object': \u003cclass 'object'>, 'range': \u003cclass 'range'>, 'reversed': \u003cclass 'reversed'>, 'set': \u003cclass 'set'>, 'slice': \u003cclass 'slice'>, 'staticmethod': \u003cclass 'staticmethod'>, 'str': \u003cclass 'str'>, 'super': \u003cclass 'super'>, 'tuple': \u003cclass 'tuple'>, 'type': \u003cclass 'type'>, 'zip': \u003cclass 'zip'>, '__debug__': True, 'BaseException': \u003cclass 'BaseException'>, 'Exception': \u003cclass 'Exception'>, 'TypeError': \u003cclass 'TypeError'>, 'StopAsyncIteration': \u003cclass 'StopAsyncIteration'>, 'StopIteration': \u003cclass 'StopIteration'>, 'GeneratorExit': \u003cclass 'GeneratorExit'>, 'SystemExit': \u003cclass 'SystemExit'>, 'KeyboardInterrupt': \u003cclass 'KeyboardInterrupt'>, 'ImportError': \u003cclass 'ImportError'>, 'ModuleNotFoundError': \u003cclass 'ModuleNotFoundError'>, 'OSError': \u003cclass 'OSError'>, 'EnvironmentError': \u003cclass 'OSError'>, 'IOError': \u003cclass 'OSError'>, 'EOFError': \u003cclass 'EOFError'>, 'RuntimeError': \u003cclass 'RuntimeError'>, 'RecursionError': \u003cclass 'RecursionError'>, 'NotImplementedError': \u003cclass 'NotImplementedError'>, 'NameError': \u003cclass 'NameError'>, 'UnboundLocalError': \u003cclass 'UnboundLocalError'>, 'AttributeError': \u003cclass 'AttributeError'>, 'SyntaxError': \u003cclass 'SyntaxError'>, 'IndentationError': \u003cclass 'IndentationError'>, 'TabError': \u003cclass 'TabError'>, 'LookupError': \u003cclass 'LookupError'>, 'IndexError': \u003cclass 'IndexError'>, 'KeyError': \u003cclass 'KeyError'>, 'ValueError': \u003cclass 'ValueError'>, 'UnicodeError': \u003cclass 'UnicodeError'>, 'UnicodeEncodeError': \u003cclass 'UnicodeEncodeError'>, 'UnicodeDecodeError': \u003cclass 'UnicodeDecodeError'>, 'UnicodeTranslateError': \u003cclass 'UnicodeTranslateError'>, 'AssertionError': \u003cclass 'AssertionError'>, 'ArithmeticError': \u003cclass 'ArithmeticError'>, 'FloatingPointError': \u003cclass 'FloatingPointError'>, 'OverflowError': \u003cclass 'OverflowError'>, 'ZeroDivisionError': \u003cclass 'ZeroDivisionError'>, 'SystemError': \u003cclass 'SystemError'>, 'ReferenceError': \u003cclass 'ReferenceError'>, 'MemoryError': \u003cclass 'MemoryError'>, 'BufferError': \u003cclass 'BufferError'>, 'Warning': \u003cclass 'Warning'>, 'UserWarning': \u003cclass 'UserWarning'>, 'DeprecationWarning': \u003cclass 'DeprecationWarning'>, 'PendingDeprecationWarning': \u003cclass 'PendingDeprecationWarning'>, 'SyntaxWarning': \u003cclass 'SyntaxWarning'>, 'RuntimeWarning': \u003cclass 'RuntimeWarning'>, 'FutureWarning': \u003cclass 'FutureWarning'>, 'ImportWarning': \u003cclass 'ImportWarning'>, 'UnicodeWarning': \u003cclass 'UnicodeWarning'>, 'BytesWarning': \u003cclass 'BytesWarning'>, 'ResourceWarning': \u003cclass 'ResourceWarning'>, 'ConnectionError': \u003cclass 'ConnectionError'>, 'BlockingIOError': \u003cclass 'BlockingIOError'>, 'BrokenPipeError': \u003cclass 'BrokenPipeError'>, 'ChildProcessError': \u003cclass 'ChildProcessError'>, 'ConnectionAbortedError': \u003cclass 'ConnectionAbortedError'>, 'ConnectionRefusedError': \u003cclass 'ConnectionRefusedError'>, 'ConnectionResetError': \u003cclass 'ConnectionResetError'>, 'FileExistsError': \u003cclass 'FileExistsError'>, 'FileNotFoundError': \u003cclass 'FileNotFoundError'>, 'IsADirectoryError': \u003cclass 'IsADirectoryError'>, 'NotADirectoryError': \u003cclass 'NotADirectoryError'>, 'InterruptedError': \u003cclass 'InterruptedError'>, 'PermissionError': \u003cclass 'PermissionError'>, 'ProcessLookupError': \u003cclass 'ProcessLookupError'>, 'TimeoutError': \u003cclass 'TimeoutError'>, 'open': \u003cbuilt-in function open>, 'copyright': Copyright (c) 2001-2021 Python Software Foundation.\r\nAll Rights Reserved.\r\n\r\nCopyright (c) 2000 BeOpen.com.\r\nAll Rights Reserved.\r\n\r\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\r\nAll Rights Reserved.\r\n\r\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\r\nAll Rights Reserved., 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands\r\n for supporting Python development. See www.python.org for more information., 'license': Type license() to see the full license text, 'help': Type help() for interactive help, or help(object) for help about object., '__IPYTHON__': True, 'display': \u003cfunction display at 0x7f1ee1591d30>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit}, 'help': Type help() for interactive help, or help(object) for help about object., 'atexit': \u003cmodule 'atexit' (built-in)>, 'os': \u003cmodule 'osIn : locals()\r\nIn: # Next line `exit()` is inputted\r\nIn : exit()\r\nipdb> quit\r\nTraceback (most recent call last):\r\n File \"\u003cstring>\", line 1, in \u003cmodule>\r\n File \"/usr/lib/python3.9/bdb.py\", line 92, in trace_dispatch\r\n return self.dispatch_return(frame, arg)\r\n File \"/usr/lib/python3.9/bdb.py\", line 154, in dispatch_return\r\n if self.quitting: raise BdbQuit\r\nbdb.BdbQuit\r\n```\r\nWhen dicts are inputted as 1st or 2nd rows without writing a comment first, those are not printed to output. In this case `{'foo': 'bar'}` is written to the first BPython prompt.\r\n```sh\r\n\r\n$ python -c 'from IPython.terminal.debugger import set_trace; set_trace()'\r\n--Return--\r\nNone\r\n> \u003cstring>(1)\u003cmodule>()\r\n\r\nipdb> import bpython; bpython.embed()\r\n\r\nIn : {'foo': 'bar'}\r\nIn : exit()\r\nIn : exit()\r\nipdb> quit\r\nTraceback (most recent call last):\r\n File \"\u003cstring>\", line 1, in \u003cmodule>\r\n File \"/usr/lib/python3.9/bdb.py\", line 92, in trace_dispatch\r\n return self.dispatch_return(frame, arg)\r\n File \"/usr/lib/python3.9/bdb.py\", line 154, in dispatch_return\r\n if self.quitting: raise BdbQuit\r\nbdb.BdbQuit\r\n```\r\nThe `{'foo: 'bar'}` flashes just after the input without a new line and then immediately disappears.\r\n","author":{"url":"https://github.com/Jaakkonen","@type":"Person","name":"Jaakkonen"},"datePublished":"2021-08-16T22:11:31Z","url":"https://github.com/bpython/bpython/issues/907"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4da5089f-cbf8-bdb4-50ec-7a3890456a45 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B56:2C69FC:1526B0B:1C196B1:6B01FDB0 |
| html-safe-nonce | 7d2d46ad3021ebb85d34408843575ab2f753e4e2bd070b13b47b18d7fbf55b52 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjU2OjJDNjlGQzoxNTI2QjBCOjFDMTk2QjE6NkIwMUZEQjAiLCJ2aXNpdG9yX2lkIjoiOTEyOTEyODE3MjU2OTM2MTg0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 716c583ad97de9ca08e0d3de6f7d506cd31139a6c318e0aeccfef5ff7e5331c0 |
| hovercard-subject-tag | issue:972137940 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bpython/bpython/907/issue_layout |
| twitter:image | https://opengraph.githubassets.com/482f5a95d1dc90f2c6178f7ffea98cb2a94a883214fc1cd0d795750808749be6/bpython/bpython/issues/907 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/482f5a95d1dc90f2c6178f7ffea98cb2a94a883214fc1cd0d795750808749be6/bpython/bpython/issues/907 |
| og:image:alt | Description BPython prompt breaks when executing .embed() from ipdb context. New lines are not shown after input, prompt text is altered by IPython and not reset by bpython, dict outputs do not sho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Jaakkonen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/bpython/bpython git https://github.com/bpython/bpython.git |
| octolytics-dimension-user_id | 8071396 |
| octolytics-dimension-user_login | bpython |
| octolytics-dimension-repository_id | 21508865 |
| octolytics-dimension-repository_nwo | bpython/bpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21508865 |
| octolytics-dimension-repository_network_root_nwo | bpython/bpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width