summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/22_all_turkish_locale.patch')
-rw-r--r--patches/22_all_turkish_locale.patch120
1 files changed, 99 insertions, 21 deletions
diff --git a/patches/22_all_turkish_locale.patch b/patches/22_all_turkish_locale.patch
index 5d8bc6a..b41c4c9 100644
--- a/patches/22_all_turkish_locale.patch
+++ b/patches/22_all_turkish_locale.patch
@@ -1,24 +1,102 @@
---- Lib/email/__init__.py
-+++ Lib/email/__init__.py
-@@ -109,15 +109,19 @@
- 'Text',
- ]
+--- Objects/stringobject.c
++++ Objects/stringobject.c
+@@ -1975,10 +1975,14 @@
+ \n\
+ Return a copy of the string S converted to lowercase.");
-+import string
-+lower_map = string.maketrans(string.ascii_uppercase, string.ascii_lowercase)
-+
-+
- for _name in _LOWERNAMES:
-- importer = LazyImporter(_name.lower())
-+ importer = LazyImporter(_name.translate(lower_map))
- sys.modules['email.' + _name] = importer
- setattr(sys.modules['email'], _name, importer)
+-/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */
+-#ifndef _tolower
+-#define _tolower tolower
+-#endif
++static int
++tolower_C_locale(int c)
++{
++ if (c >= 'A' && c <= 'Z')
++ return c + 0x20;
++ else
++ return c;
++}
+ static PyObject *
+ string_lower(PyStringObject *self)
+@@ -1998,7 +2002,7 @@
+ for (i = 0; i < n; i++) {
+ int c = Py_CHARMASK(s[i]);
+ if (isupper(c))
+- s[i] = _tolower(c);
++ s[i] = tolower_C_locale(c);
+ }
- import email.mime
- for _name in _MIMENAMES:
-- importer = LazyImporter('mime.' + _name.lower())
-+ importer = LazyImporter('mime.' + _name.translate(lower_map))
- sys.modules['email.MIME' + _name] = importer
- setattr(sys.modules['email'], 'MIME' + _name, importer)
- setattr(sys.modules['email.mime'], _name, importer)
+ return newobj;
+@@ -2009,9 +2013,14 @@
+ \n\
+ Return a copy of the string S converted to uppercase.");
+
+-#ifndef _toupper
+-#define _toupper toupper
+-#endif
++static int
++toupper_C_locale(int c)
++{
++ if (c >= 'a' && c <= 'z')
++ return c - 0x20;
++ else
++ return c;
++}
+
+ static PyObject *
+ string_upper(PyStringObject *self)
+@@ -2031,7 +2040,7 @@
+ for (i = 0; i < n; i++) {
+ int c = Py_CHARMASK(s[i]);
+ if (islower(c))
+- s[i] = _toupper(c);
++ s[i] = toupper_C_locale(c);
+ }
+
+ return newobj;
+@@ -2059,11 +2068,11 @@
+ int c = Py_CHARMASK(*s++);
+ if (islower(c)) {
+ if (!previous_is_cased)
+- c = toupper(c);
++ c = toupper_C_locale(c);
+ previous_is_cased = 1;
+ } else if (isupper(c)) {
+ if (previous_is_cased)
+- c = tolower(c);
++ c = tolower_C_locale(c);
+ previous_is_cased = 1;
+ } else
+ previous_is_cased = 0;
+@@ -2092,7 +2101,7 @@
+ if (0 < n) {
+ int c = Py_CHARMASK(*s++);
+ if (islower(c))
+- *s_new = toupper(c);
++ *s_new = toupper_C_locale(c);
+ else
+ *s_new = c;
+ s_new++;
+@@ -2100,7 +2109,7 @@
+ for (i = 1; i < n; i++) {
+ int c = Py_CHARMASK(*s++);
+ if (isupper(c))
+- *s_new = tolower(c);
++ *s_new = tolower_C_locale(c);
+ else
+ *s_new = c;
+ s_new++;
+@@ -2171,10 +2180,10 @@
+ for (i = 0; i < n; i++) {
+ int c = Py_CHARMASK(*s++);
+ if (islower(c)) {
+- *s_new = toupper(c);
++ *s_new = toupper_C_locale(c);
+ }
+ else if (isupper(c)) {
+- *s_new = tolower(c);
++ *s_new = tolower_C_locale(c);
+ }
+ else
+ *s_new = c;