[Python-checkins] gh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)

miss-islington webhook-mailer at python.org
Tue Apr 26 01:45:28 EDT 2022


https://github.com/python/cpython/commit/653a66668df818aafb76f968247cb02d2f9cd405
commit: 653a66668df818aafb76f968247cb02d2f9cd405
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-04-25T22:45:24-07:00
summary:

gh-91916: Fix test_runpy on non-UTF-8 locale (GH-91920)


If use a non-builtin codec, partially implemented in Python
(e.g. ISO-8859-15), a new RecursionError (with empty error message)
can be raised while handle a RecursionError.

Testing for error message was needed to distinguish
a recursion error from arbitrary RuntimeError. After introducing
RecursionError, it became unnecessary.
(cherry picked from commit a568585069174cec35ce26cdf4d4862c634d9f6d)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
M Lib/test/test_runpy.py

diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index 4aaf75b1bceb6..c734f0d6ce2d6 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -740,8 +740,7 @@ def test_main_recursion_error(self):
                       "runpy.run_path(%r)\n") % dummy_dir
             script_name = self._make_test_script(script_dir, mod_name, source)
             zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name)
-            msg = "recursion depth exceeded"
-            self.assertRaisesRegex(RecursionError, msg, run_path, zip_name)
+            self.assertRaises(RecursionError, run_path, zip_name)
 
     def test_encoding(self):
         with temp_dir() as script_dir:



More information about the Python-checkins mailing list