]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#9210: remove --with-wctype-functions configure option.
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Sun, 12 Sep 2010 22:42:57 +0000 (22:42 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Sun, 12 Sep 2010 22:42:57 +0000 (22:42 +0000)
The internal unicode database is now always used.

(after 5 years: see
  http://mail.python.org/pipermail/python-dev/2004-December/050193.html
)

Doc/whatsnew/3.2.rst
Include/unicodeobject.h
Misc/NEWS
Objects/unicodectype.c
Objects/unicodetype_db.h
Tools/unicode/makeunicodedata.py
configure
configure.in
pyconfig.h.in

index 7d8b2e61f2d10f90df602ca15341ee1a98a8c3c8..0f9366da43c78d61f93b53f1db1a67ab58ba4ef1 100644 (file)
@@ -525,6 +525,11 @@ Changes to Python's build process and to the C API include:
 
   (Contributed by Antoine Pitrou; :issue:`9203`.)
 
+* The option ``--with-wctype-functions`` was removed.  The built-in unicode
+  database is now used for all functions.
+
+  (Contributed by Amaury Forgeot D'Arc; :issue:`9210`.)
+
 
 Porting to Python 3.2
 =====================
index 820850ae01a300fd3b390238117e408d1a294e3d..111d7e230e978cc23a60a3b32e358ab524379b91 100644 (file)
@@ -78,7 +78,7 @@ Copyright (c) Corporation for National Research Initiatives.
 #define Py_UNICODE_WIDE
 #endif
 
-/* Set these flags if the platform has "wchar.h", "wctype.h" and the
+/* Set these flags if the platform has "wchar.h" and the
    wchar_t type is a 16-bit unsigned type */
 /* #define HAVE_WCHAR_H */
 /* #define HAVE_USABLE_WCHAR_T */
@@ -309,39 +309,6 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
 
 /* --- Internal Unicode Operations ---------------------------------------- */
 
-/* If you want Python to use the compiler's wctype.h functions instead
-   of the ones supplied with Python, define WANT_WCTYPE_FUNCTIONS or
-   configure Python using --with-wctype-functions.  This reduces the
-   interpreter's code size. */
-
-#if defined(Py_UNICODE_WIDE) && defined(HAVE_USABLE_WCHAR_T) && defined(WANT_WCTYPE_FUNCTIONS)
-
-#include <wctype.h>
-
-#define Py_UNICODE_ISSPACE(ch) iswspace(ch)
-
-#define Py_UNICODE_ISLOWER(ch) iswlower(ch)
-#define Py_UNICODE_ISUPPER(ch) iswupper(ch)
-#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch)
-#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch)
-
-#define Py_UNICODE_TOLOWER(ch) towlower(ch)
-#define Py_UNICODE_TOUPPER(ch) towupper(ch)
-#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch)
-
-#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
-#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
-#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
-#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
-
-#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
-#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
-#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
-
-#define Py_UNICODE_ISALPHA(ch) iswalpha(ch)
-
-#else
-
 /* Since splitting on whitespace is an important use case, and
    whitespace in most situations is solely ASCII whitespace, we
    optimize for the common case by using a quick look-up table
@@ -371,8 +338,6 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
 
 #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
 
-#endif
-
 #define Py_UNICODE_ISALNUM(ch) \
        (Py_UNICODE_ISALPHA(ch) || \
     Py_UNICODE_ISDECIMAL(ch) || \
index 7b06c69808c49e05c9a63733a6502b32659ef265..caec74953b6d39ee38a08898d9dfc3dc65f6e63b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@ What's New in Python 3.2 Alpha 3?
 Core and Builtins
 -----------------
 
+- Issue #9210: Configure option --with-wctype-functions was removed.  Using the
+  functions from the libc caused the methods .upper() and lower() to become
+  locale aware and created subtly wrong results.
+
 - Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
   a non-ASCII byte in the format string.
 
index f6e325082457b07e551a76d9b5dac466a952ef2c..a41ceb824023fb697aa0c92dc994cff9a2d8ce51 100644 (file)
@@ -163,8 +163,6 @@ int _PyUnicode_IsPrintable(Py_UCS4 ch)
     return (ctype->flags & PRINTABLE_MASK) != 0;
 }
 
-#ifndef WANT_WCTYPE_FUNCTIONS
-
 /* Returns 1 for Unicode characters having the category 'Ll', 0
    otherwise. */
 
@@ -223,34 +221,3 @@ int _PyUnicode_IsAlpha(Py_UCS4 ch)
     return (ctype->flags & ALPHA_MASK) != 0;
 }
 
-#else
-
-/* Export the interfaces using the wchar_t type for portability
-   reasons:  */
-
-int _PyUnicode_IsLowercase(Py_UCS4 ch)
-{
-    return iswlower(ch);
-}
-
-int _PyUnicode_IsUppercase(Py_UCS4 ch)
-{
-    return iswupper(ch);
-}
-
-Py_UCS4 _PyUnicode_ToLowercase(Py_UCS4 ch)
-{
-    return towlower(ch);
-}
-
-Py_UCS4 _PyUnicode_ToUppercase(Py_UCS4 ch)
-{
-    return towupper(ch);
-}
-
-int _PyUnicode_IsAlpha(Py_UCS4 ch)
-{
-    return iswalpha(ch);
-}
-
-#endif
index 637f6298cd5737d2acc5b79664c1d3fade606a05..ef18b95cf3fd7ed9dd7deb91cf3b185192313960 100644 (file)
@@ -3247,9 +3247,6 @@ double _PyUnicode_ToNumeric(Py_UCS4 ch)
  */
 int _PyUnicode_IsWhitespace(register const Py_UCS4 ch)
 {
-#ifdef WANT_WCTYPE_FUNCTIONS
-    return iswspace(ch);
-#else
     switch (ch) {
     case 0x0009:
     case 0x000A:
@@ -3284,7 +3281,6 @@ int _PyUnicode_IsWhitespace(register const Py_UCS4 ch)
         return 1;
     }
     return 0;
-#endif
 }
 
 /* Returns 1 for Unicode characters having the line break
index 7266a91c4ec9c93771bcb6c1fd4b220a218a84e2..b2615eefcd1b06e43fd84824a5a635644305a1dd 100644 (file)
@@ -503,9 +503,6 @@ def makeunicodetype(unicode, trace):
     print(" */", file=fp)
     print('int _PyUnicode_IsWhitespace(register const Py_UCS4 ch)', file=fp)
     print('{', file=fp)
-    print('#ifdef WANT_WCTYPE_FUNCTIONS', file=fp)
-    print('    return iswspace(ch);', file=fp)
-    print('#else', file=fp)
     print('    switch (ch) {', file=fp)
 
     for codepoint in sorted(spaces):
@@ -514,7 +511,6 @@ def makeunicodetype(unicode, trace):
 
     print('    }', file=fp)
     print('    return 0;', file=fp)
-    print('#endif', file=fp)
     print('}', file=fp)
     print(file=fp)
 
index 8bd1ea5127e5ebdbdd4f88669bac5307747aafc6..a3826ef169bf06a0a2c48a70492fb6c11372b133 100755 (executable)
--- a/configure
+++ b/configure
@@ -747,7 +747,6 @@ with_doc_strings
 with_tsc
 with_pymalloc
 with_valgrind
-with_wctype_functions
 with_fpectl
 with_libm
 with_libc
@@ -1418,7 +1417,6 @@ Optional Packages:
   --with(out)-tsc         enable/disable timestamp counter profile
   --with(out)-pymalloc    disable/enable specialized mallocs
   --with-valgrind         Enable Valgrind support
-  --with-wctype-functions use wctype.h functions
   --with-fpectl           enable SIGFPE catching
   --with-libm=STRING      math library
   --with-libc=STRING      C library
@@ -9232,28 +9230,6 @@ fi
     OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
 fi
 
-# Check for --with-wctype-functions
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-wctype-functions" >&5
-$as_echo_n "checking for --with-wctype-functions... " >&6; }
-
-# Check whether --with-wctype-functions was given.
-if test "${with_wctype_functions+set}" = set; then :
-  withval=$with_wctype_functions;
-if test "$withval" != no
-then
-
-$as_echo "#define WANT_WCTYPE_FUNCTIONS 1" >>confdefs.h
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
 
 # -I${DLINCLDIR} is added to the compile rule for importdl.o
 
index b4672848aeb38b4de59d0b3a0e6dd9dd50c3b4c7..c6a51a324a9e9cbe32938638b6fe5767f77c2860 100644 (file)
@@ -2493,21 +2493,6 @@ if test "$with_valgrind" != no; then
     OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
 fi
 
-# Check for --with-wctype-functions
-AC_MSG_CHECKING(for --with-wctype-functions)
-AC_ARG_WITH(wctype-functions, 
-            AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
-[
-if test "$withval" != no
-then 
-  AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
-  [Define if you want wctype.h functions to be used instead of the
-   one supplied by Python itself. (see Include/unicodectype.h).]) 
-  AC_MSG_RESULT(yes)
-else AC_MSG_RESULT(no)
-fi],
-[AC_MSG_RESULT(no)])
-
 # -I${DLINCLDIR} is added to the compile rule for importdl.o
 AC_SUBST(DLINCLDIR)
 DLINCLDIR=.
index b26b44163add1b7455035f47d059eae2e37de59c..545dbe38115be88f8655dafffdcb27bbdabe57de 100644 (file)
 /* Define if you want SIGFPE handled (see Include/pyfpe.h). */
 #undef WANT_SIGFPE_HANDLER
 
-/* Define if you want wctype.h functions to be used instead of the one
-   supplied by Python itself. (see Include/unicodectype.h). */
-#undef WANT_WCTYPE_FUNCTIONS
-
 /* Define if WINDOW in curses.h offers a field _flags. */
 #undef WINDOW_HAS_FLAGS