Title: Uncaught exception by `repl.complete` · Issue #776 · bpython/bpython · GitHub
Open Graph Title: Uncaught exception by `repl.complete` · Issue #776 · bpython/bpython
X Title: Uncaught exception by `repl.complete` · Issue #776 · bpython/bpython
Description: When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example, __getattribute__ of the user code happens sometimes. bpython should stomach ...
Open Graph Description: When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example, __getattribute__ of the user code ha...
X Description: When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example, __getattribute__ of the user code ha...
Opengraph URL: https://github.com/bpython/bpython/issues/776
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Uncaught exception by `repl.complete`","articleBody":"When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example, `__getattribute__` of the user code happens sometimes. bpython should stomach such errors.\r\n\r\nMinimal reproducing example:\r\n```\r\n$ bpython3\r\nbpython version 0.17.1 on top of Python 3.7.3 /usr/bin/python3\r\n\u003e\u003e\u003e class BadClass:\r\n... def __getattribute__(self, name):\r\n... assert False, \"Let's say there is a bug here.\"\r\n... \r\n\u003e\u003e\u003e x = BadClass()\r\n\u003e\u003e\u003e x(\r\nTraceback (most recent call last):\r\n File \"/usr/bin/bpython3\", line 11, in \u003cmodule\u003e\r\n load_entry_point('bpython==0.17.1', 'console_scripts', 'bpython')()\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsies.py\", line 191, in main\r\n exit_value = repl.mainloop(True, paste)\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsies.py\", line 126, in mainloop\r\n self.process_event_and_paint(e)\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsies.py\", line 90, in process_event_and_paint\r\n self.process_event(e)\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py\", line 603, in process_event\r\n return self.process_key_event(e)\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py\", line 757, in process_key_event\r\n self.add_normal_character(e)\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py\", line 1001, in add_normal_character\r\n self.cursor_offset += 1\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py\", line 1594, in _set_cursor_offset\r\n self.update_completion()\r\n File \"/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py\", line 1032, in update_completion\r\n self.list_win_visible = self.complete(tab)\r\n File \"/usr/lib/python3/dist-packages/bpython/repl.py\", line 724, in complete\r\n self.set_docstring()\r\n File \"/usr/lib/python3/dist-packages/bpython/repl.py\", line 688, in set_docstring\r\n if not self.get_args():\r\n File \"/usr/lib/python3/dist-packages/bpython/repl.py\", line 635, in get_args\r\n if inspect.isclass(f):\r\n File \"/usr/lib/python3.7/inspect.py\", line 78, in isclass\r\n return isinstance(object, type)\r\n File \"\u003cbpython-input-5\u003e\", line 3, in __getattribute__\r\nAssertionError: Let's say there is a bug here.\r\n[$? = 1]\r\n```\r\n\r\nIn the above session, I typed the `(`, but it did not appear on screen. (Boo me, I edited that part.)\r\n\r\nI see two ways to fix this: Either wrap the code in `complete` in a `try … finally`, or wrap all the places where user code gets called. (This might be hard to find.)\r\n\r\nNone of the other issues seem to be related.","author":{"url":"https://github.com/BenWiederhake","@type":"Person","name":"BenWiederhake"},"datePublished":"2019-07-15T23:57:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/776/bpython/issues/776"}
| 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:68011fad-49d0-56dd-a35e-8b07c39237a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F88:1FFE51:523A73C:70DC9D1:69670A4E |
| html-safe-nonce | ea0a542b5a89513827c04c240348591f401d9cd46e1ec89ca77f2a902faddb93 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Rjg4OjFGRkU1MTo1MjNBNzNDOjcwREM5RDE6Njk2NzBBNEUiLCJ2aXNpdG9yX2lkIjoiNDk1MDgxMjQ3MDUwNTAwNjg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ab7ad39dcc28585eeee20331a15f26d525c7cbb03653514e42985d6a924c2825 |
| hovercard-subject-tag | issue:468384552 |
| 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/776/issue_layout |
| twitter:image | https://opengraph.githubassets.com/24a91e84950376e41c171c7f2d7cff7e4655c9bc327c01cb8d345c2c937931f6/bpython/bpython/issues/776 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/24a91e84950376e41c171c7f2d7cff7e4655c9bc327c01cb8d345c2c937931f6/bpython/bpython/issues/776 |
| og:image:alt | When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example, __getattribute__ of the user code ha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BenWiederhake |
| hostname | github.com |
| expected-hostname | github.com |
| None | 10b629569a71f325bbe100683b0ccc26c67ec87331658842c73b5ea71f03ac7b |
| 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 | 1e8b7c19c9a48ebea057f7443387e8fbbc97710a |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width