[Python-checkins] r84752 - in python/branches/py3k: 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

amaury.forgeotdarc python-checkins at python.org
Mon Sep 13 00:42:57 CEST 2010


Author: amaury.forgeotdarc
Date: Mon Sep 13 00:42:57 2010
New Revision: 84752

Log:
#9210: remove --with-wctype-functions configure option.
The internal unicode database is now always used.

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


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

Modified: python/branches/py3k/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k/Doc/whatsnew/3.2.rst	(original)
+++ python/branches/py3k/Doc/whatsnew/3.2.rst	Mon Sep 13 00:42:57 2010
@@ -525,6 +525,11 @@
 
   (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
 =====================

Modified: python/branches/py3k/Include/unicodeobject.h
==============================================================================
--- python/branches/py3k/Include/unicodeobject.h	(original)
+++ python/branches/py3k/Include/unicodeobject.h	Mon Sep 13 00:42:57 2010
@@ -78,7 +78,7 @@
 #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 @@
 
 /* --- 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 @@
 
 #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
 
-#endif
-
 #define Py_UNICODE_ISALNUM(ch) \
        (Py_UNICODE_ISALPHA(ch) || \
     Py_UNICODE_ISDECIMAL(ch) || \

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Mon Sep 13 00:42:57 2010
@@ -10,6 +10,10 @@
 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.
 

Modified: python/branches/py3k/Objects/unicodectype.c
==============================================================================
--- python/branches/py3k/Objects/unicodectype.c	(original)
+++ python/branches/py3k/Objects/unicodectype.c	Mon Sep 13 00:42:57 2010
@@ -163,8 +163,6 @@
     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 @@
     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

Modified: python/branches/py3k/Objects/unicodetype_db.h
==============================================================================
--- python/branches/py3k/Objects/unicodetype_db.h	(original)
+++ python/branches/py3k/Objects/unicodetype_db.h	Mon Sep 13 00:42:57 2010
@@ -3247,9 +3247,6 @@
  */
 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 @@
         return 1;
     }
     return 0;
-#endif
 }
 
 /* Returns 1 for Unicode characters having the line break

Modified: python/branches/py3k/Tools/unicode/makeunicodedata.py
==============================================================================
--- python/branches/py3k/Tools/unicode/makeunicodedata.py	(original)
+++ python/branches/py3k/Tools/unicode/makeunicodedata.py	Mon Sep 13 00:42:57 2010
@@ -503,9 +503,6 @@
     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 @@
 
     print('    }', file=fp)
     print('    return 0;', file=fp)
-    print('#endif', file=fp)
     print('}', file=fp)
     print(file=fp)
 

Modified: python/branches/py3k/configure
==============================================================================
--- python/branches/py3k/configure	(original)
+++ python/branches/py3k/configure	Mon Sep 13 00:42:57 2010
@@ -747,7 +747,6 @@
 with_tsc
 with_pymalloc
 with_valgrind
-with_wctype_functions
 with_fpectl
 with_libm
 with_libc
@@ -1418,7 +1417,6 @@
   --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 @@
     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
 

Modified: python/branches/py3k/configure.in
==============================================================================
--- python/branches/py3k/configure.in	(original)
+++ python/branches/py3k/configure.in	Mon Sep 13 00:42:57 2010
@@ -2493,21 +2493,6 @@
     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=.

Modified: python/branches/py3k/pyconfig.h.in
==============================================================================
--- python/branches/py3k/pyconfig.h.in	(original)
+++ python/branches/py3k/pyconfig.h.in	Mon Sep 13 00:42:57 2010
@@ -1077,10 +1077,6 @@
 /* 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
 


More information about the Python-checkins mailing list