[3.14] gh-130999: Avoid exiting the new REPL when there are non-string candidates for suggestions (gh-131001) (gh-135019)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Miss Islington (bot) 2025-06-02 16:58:03 +02:00 committed by GitHub
parent 0947773528
commit 7775d93e2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 4 deletions

View file

@ -1672,6 +1672,17 @@ def test_null_byte(self):
self.assertEqual(exit_code, 0)
self.assertNotIn("TypeError", output)
@force_not_colorized
def test_non_string_suggestion_candidates(self):
commands = ("import runpy\n"
"runpy._run_module_code('blech', {0: '', 'bluch': ''}, '')\n"
"exit()\n")
output, exit_code = self.run_repl(commands)
self.assertEqual(exit_code, 0)
self.assertNotIn("all elements in 'candidates' must be strings", output)
self.assertIn("bluch", output)
def test_readline_history_file(self):
# skip, if readline module is not available
readline = import_module('readline')