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 libedit one, and that doesn't always work properly.
Your environment
Python 3.11 MacOs Ventura.
Here's some code that won't work with libedit readline:
import cmd
class MyShell(cmd.Cmd):
def do_command(self, _arg):
print(f"running {self}")
MyShell().cmdloop()
Tab-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.
So 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.