diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a42e2b2a28a..2dc0441bd47 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4537,6 +4537,13 @@ def __PYTHON_EL_native_completion_setup(): if not is_ipython: readline.set_completer(new_completer) else: + # Ensure that rlcompleter.__main__ and __main__ are identical. + # (Bug#76205) + import sys + try: + sys.modules['rlcompleter'].__main__ = sys.modules['__main__'] + except KeyError: + pass # Try both initializations to cope with all IPython versions. # This works fine for IPython 3.x but not for earlier: readline.set_completer(new_completer)