Kaydet (Commit) cf9d3c08 authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Issue #1813: Fix codec lookup under Turkish locales.

üst 216a3bc3
from test import support
import unittest
import codecs
import locale
import sys, _testcapi, io
class Queue(object):
......@@ -1230,6 +1231,19 @@ class CodecsModuleTest(unittest.TestCase):
self.assertRaises(TypeError, codecs.getwriter)
self.assertRaises(LookupError, codecs.getwriter, "__spam__")
def test_lookup_issue1813(self):
# Issue #1813: under Turkish locales, lookup of some codecs failed
# because 'I' is lowercased as "ı" (dotless i)
oldlocale = locale.getlocale(locale.LC_CTYPE)
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
try:
locale.setlocale(locale.LC_CTYPE, 'tr_TR')
except locale.Error:
# Unsupported locale on this system
self.skipTest('test needs Turkish locale')
c = codecs.lookup('ASCII')
self.assertEqual(c.name, 'ascii')
class StreamReaderTest(unittest.TestCase):
def setUp(self):
......
......@@ -37,6 +37,8 @@ Core and Builtins
Library
-------
- Issue #1813: Fix codec lookup under Turkish locales.
- Issue #12591: Improve support of "universal newlines" in the subprocess
module: the piped streams can now be properly read from or written to.
......
......@@ -69,7 +69,7 @@ PyObject *normalizestring(const char *string)
if (ch == ' ')
ch = '-';
else
ch = tolower(Py_CHARMASK(ch));
ch = Py_TOLOWER(Py_CHARMASK(ch));
p[i] = ch;
}
p[i] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment