Title: cmd.py command completion does not work with libedit · Issue #102130 · python/cpython · GitHub
Open Graph Title: cmd.py command completion does not work with libedit · Issue #102130 · python/cpython
X Title: cmd.py command completion does not work with libedit · Issue #102130 · python/cpython
Description: Bug report As title, the Homebrew community has switched to libedit readline as of Python 3.11. There exists a gnureadline package which allows one to continue using the gnu readline, but unfortunately cmd.py will continue to use the lib...
Open Graph Description: Bug report As title, the Homebrew community has switched to libedit readline as of Python 3.11. There exists a gnureadline package which allows one to continue using the gnu readline, but unfortuna...
X Description: Bug report As title, the Homebrew community has switched to libedit readline as of Python 3.11. There exists a gnureadline package which allows one to continue using the gnu readline, but unfortuna...
Opengraph URL: https://github.com/python/cpython/issues/102130
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"cmd.py command completion does not work with libedit","articleBody":"# Bug report\r\n\r\nAs title, the Homebrew community has switched to libedit readline as of Python 3.11. There exists a gnureadline package which allows one to continue using the gnu readline, but unfortunately cmd.py will continue to use the libedit one, and that doesn't always work properly.\r\n\r\n# Your environment\r\n\r\nPython 3.11 MacOs Ventura.\r\n\r\nHere's some code that won't work with libedit readline:\r\n\r\n```python\r\nimport cmd\r\n\r\nclass MyShell(cmd.Cmd):\r\n def do_command(self, _arg):\r\n print(f\"running {self}\")\r\n\r\nMyShell().cmdloop()\r\n```\r\nTab-completion appears to fail on Homebrew python 3.11, I suspect due to the libedit readline. The code works fine with Homebrew python versions up to 3.10 which use gnu readline. Also, if you install gnureadline and change all occurrences of `import readline` in cmd.py to `import gnureadline as readline` the cmd module works perfectly.\r\n\r\nSo in summary could we fix cmd.py to work correctly with libedit as well as gnu readline? Or, failing that provide some fairly easy means of overriding the readline used by cmd.py without resorting to nasty monkey patching.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-107738\n* gh-107748\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/keeely","@type":"Person","name":"keeely"},"datePublished":"2023-02-21T21:45:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":17},"url":"https://github.com/102130/cpython/issues/102130"}
| 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:4cf50ba6-363d-3290-5f5f-6a88fa241345 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B696:12A9AF:886A7B:AF2213:696B1B47 |
| html-safe-nonce | e504c3b3d7264d2057b7db3fc4a6a959ae398b87fc252f975711cd832c921630 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjk2OjEyQTlBRjo4ODZBN0I6QUYyMjEzOjY5NkIxQjQ3IiwidmlzaXRvcl9pZCI6IjY2MjEzMDA4ODcyODE5MzMxMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6b66f0040d7c4687310b90cd540284690d978c69480784a29bb98335c0fe9a2f |
| hovercard-subject-tag | issue:1594137751 |
| 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/python/cpython/102130/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ad05f50d0d2e8bcb8c31fae17dc1d05cb57f7c28d596e3221bf4c085ad4fdb2/python/cpython/issues/102130 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ad05f50d0d2e8bcb8c31fae17dc1d05cb57f7c28d596e3221bf4c085ad4fdb2/python/cpython/issues/102130 |
| og:image:alt | Bug report As title, the Homebrew community has switched to libedit readline as of Python 3.11. There exists a gnureadline package which allows one to continue using the gnu readline, but unfortuna... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | keeely |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width