File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 11from test import support
22import unittest
33import codecs
4+ import locale
45import sys , _testcapi , io
56
67class Queue (object ):
@@ -1230,6 +1231,19 @@ def test_getwriter(self):
12301231 self .assertRaises (TypeError , codecs .getwriter )
12311232 self .assertRaises (LookupError , codecs .getwriter , "__spam__" )
12321233
1234+ def test_lookup_issue1813 (self ):
1235+ # Issue #1813: under Turkish locales, lookup of some codecs failed
1236+ # because 'I' is lowercased as "ı" (dotless i)
1237+ oldlocale = locale .getlocale (locale .LC_CTYPE )
1238+ self .addCleanup (locale .setlocale , locale .LC_CTYPE , oldlocale )
1239+ try :
1240+ locale .setlocale (locale .LC_CTYPE , 'tr_TR' )
1241+ except locale .Error :
1242+ # Unsupported locale on this system
1243+ self .skipTest ('test needs Turkish locale' )
1244+ c = codecs .lookup ('ASCII' )
1245+ self .assertEqual (c .name , 'ascii' )
1246+
12331247class StreamReaderTest (unittest .TestCase ):
12341248
12351249 def setUp (self ):
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ Core and Builtins
3737Library
3838-------
3939
40+ - Issue #1813: Fix codec lookup under Turkish locales.
41+
4042- Issue #12591: Improve support of "universal newlines" in the subprocess
4143 module: the piped streams can now be properly read from or written to.
4244
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ PyObject *normalizestring(const char *string)
6969 if (ch == ' ' )
7070 ch = '-' ;
7171 else
72- ch = tolower (Py_CHARMASK (ch ));
72+ ch = Py_TOLOWER (Py_CHARMASK (ch ));
7373 p [i ] = ch ;
7474 }
7575 p [i ] = '\0' ;
You can’t perform that action at this time.
0 commit comments