#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
)
This commit is contained in:
Amaury Forgeot d'Arc 2010-09-12 22:42:57 +00:00
parent b2f98401d1
commit feb7307db4
9 changed files with 10 additions and 120 deletions

View 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
=====================

View 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) || \

View File

@ -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.

View 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

View 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

View 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)

24
configure vendored
View File

@ -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

View 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=.

View File

@ -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