Index: Lib/curses/__init__.py =================================================================== --- Lib/curses/__init__.py (revision 86886) +++ Lib/curses/__init__.py (working copy) @@ -56,4 +56,4 @@ try: has_key except NameError: - from has_key import has_key + from curses.has_key import has_key Index: Lib/test/test_curses.py =================================================================== --- Lib/test/test_curses.py (revision 86886) +++ Lib/test/test_curses.py (working copy) @@ -240,6 +240,7 @@ ]: if ascii.unctrl(ch) != expected: print('curses.unctrl fails on character', repr(ch)) + test_issue10598() def test_userptr_without_set(stdscr): @@ -264,6 +265,12 @@ curses.ungetch(1025) stdscr.getkey() +def test_issue10598(): + import _curses + del _curses.has_key + del sys.modules['curses'] + import curses + def main(stdscr): curses.savetty() try: