]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-153395: Fix test_complexchar on narrow curses builds (GH-154005)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 18 Jul 2026 16:33:03 +0000 (19:33 +0300)
committerGitHub <noreply@github.com>
Sat, 18 Jul 2026 16:33:03 +0000 (19:33 +0300)
On a narrow build, complexchar() of a multibyte character raises
OverflowError, not ValueError.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_curses.py

index 3ba79be789cf3e50e52be560a8fc9a3242f66f87..915eae5ec233d5100da7fa49f5a85500818719cd 100644 (file)
@@ -2799,9 +2799,11 @@ class TestAscii(unittest.TestCase):
         # its single character.  A narrow build just forms fewer cells.
         cc = curses.complexchar
         def storable(s):
+            # ValueError if s has combining marks on a narrow build.
+            # OverflowError if s is a multibyte character on a narrow build.
             try:
                 cc(s)
-            except ValueError:
+            except (ValueError, OverflowError):
                 return False
             return True