File: issue1813.dpatch

package info (click to toggle)
python2.5 2.5.2-15%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 55,940 kB
  • ctags: 97,448
  • sloc: ansic: 354,616; python: 320,341; sh: 16,213; asm: 6,567; makefile: 4,281; lisp: 3,696; perl: 3,674; xml: 894; objc: 756; sed: 2
file content (95 lines) | stat: -rw-r--r-- 2,912 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/sh -e

# DP: Fix issues with turkish locale.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
        exit 1
esac
exit 0

--- Lib/decimal.py	2008-01-08 23:42:03.000000000 +0200
+++ Lib/decimal.py	2008-01-15 05:21:33.000000000 +0200
@@ -146,6 +146,12 @@
 ROUND_HALF_DOWN = 'ROUND_HALF_DOWN'
 ROUND_05UP = 'ROUND_05UP'
 
+import string
+
+def ascii_upper(s):
+    trans_table = string.maketrans(string.ascii_lowercase, string.ascii_uppercase)
+    return s.translate(trans_table)
+
 # Errors
 
 class DecimalException(ArithmeticError):
@@ -3354,7 +3366,7 @@
                                     if name.startswith('_round_')]
 for name in rounding_functions:
     # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
-    globalname = name[1:].upper()
+    globalname = ascii_upper(name[1:])
     val = globals()[globalname]
     Decimal._pick_rounding_function[val] = name
 
--- Python/codecs.c	2006-06-23 17:16:18.000000000 -0400
+++ Python/codecs.c	2007-10-30 12:51:10.000000000 -0400
@@ -45,6 +45,11 @@ int PyCodec_Register(PyObject *search_fu
     return -1;
 }
 
+/* isupper() forced into the ASCII Locale */
+#define ascii_isupper(x) (((x) >= 0x41) && ((x) <= 0x5A))
+/* tolower() forced into the ASCII Locale */
+#define ascii_tolower(x) (ascii_isupper(x) ? ((x) + 0x20) : (x))
+
 /* Convert a string to a normalized Python string: all characters are
    converted to lower case, spaces are replaced with underscores. */
 
@@ -70,7 +75,7 @@ PyObject *normalizestring(const char *st
         if (ch == ' ')
             ch = '-';
         else
-            ch = tolower(Py_CHARMASK(ch));
+            ch = ascii_tolower(Py_CHARMASK(ch));
 	p[i] = ch;
     }
     return v;
--- Lib/email/__init__.py	2008-07-02 18:58:15.000000000 +0300
+++ Lib/email/__init__.py	2008-07-02 18:59:28.000000000 +0300
@@ -109,15 +109,18 @@
     'Text',
     ]
 
+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)
 
 
 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)