Skip to content

Commit c32fa1f

Browse files
Use 'Gwichʼin' in tests.
1 parent 7c904e7 commit c32fa1f

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

Lib/test/test_locale.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,8 @@ def test_strcoll_with_diacritic(self):
370370
"gh-124108: NetBSD doesn't support UTF-8 for LC_COLLATE")
371371
def test_strxfrm_with_diacritic(self):
372372
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
373-
374-
# @unittest.skipUnless(sys.platform == 'darwin',
375-
# "only macOS")
376-
def test_xxx(self):
377-
bad = []
378-
for c in map(chr, range(1, 0x1000)):
379-
if c.isprintable():
380-
for n in range(8):
381-
x = 'a'*n + c
382-
s = locale.strxfrm(x)
383-
if '\1' in s and s.index('\1') < len(x):
384-
bad += c
385-
print(f'{x!r} {x!a} -> {s!a}')
386-
break
387-
self.fail(repr(''.join(bad)))
373+
# gh-130567: Should not crash on macOS.
374+
locale.strxfrm('Gwich\u02bcin')
388375

389376

390377
class NormalizeTest(unittest.TestCase):

Modules/_localemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ _locale_strxfrm_impl(PyObject *module, PyObject *str)
457457

458458
/* assume no change in size, first */
459459
n1 = n1 + 1;
460-
buf = PyMem_New(wchar_t, n1+1);
460+
buf = PyMem_New(wchar_t, n1);
461461
if (!buf) {
462462
PyErr_NoMemory();
463463
goto exit;

0 commit comments

Comments
 (0)