Remove traces of Py_USING_UNICODE and Unicode-specific conditionals in configure.

Rename --enable-unicode to --with-wide-unicode; the default is still not wide.
This commit is contained in:
Georg Brandl 2008-01-07 18:10:24 +00:00
parent 22ec03c286
commit 52d168a995
9 changed files with 93 additions and 132 deletions

View File

@ -751,7 +751,7 @@ Encodings and Unicode
Unicode strings are stored internally as sequences of codepoints (to be precise
as :ctype:`Py_UNICODE` arrays). Depending on the way Python is compiled (either
via :option:`--enable-unicode=ucs2` or :option:`--enable-unicode=ucs4`, with the
via :option:`--without-wide-unicode` or :option:`--with-wide-unicode`, with the
former being the default) :ctype:`Py_UNICODE` is either a 16-bit or 32-bit data
type. Once a Unicode object is used outside of CPU and memory, CPU endianness
and how these arrays are stored as bytes become an issue. Transforming a

View File

@ -171,7 +171,6 @@ DYNLOADFILE= @DYNLOADFILE@
MACHDEP_OBJS= @MACHDEP_OBJS@
LIBOBJDIR= Python/
LIBOBJS= @LIBOBJS@
UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
@ -320,8 +319,9 @@ OBJECT_OBJS= \
Objects/structseq.o \
Objects/tupleobject.o \
Objects/typeobject.o \
Objects/weakrefobject.o \
$(UNICODE_OBJS)
Objects/unicodeobject.o \
Objects/unicodectype.o \
Objects/weakrefobject.o
##########################################################################

View File

@ -7,7 +7,7 @@ Python News
What's New in Python 3.0a3?
===========================
*Release data: XX-XXX-2008*
*Release date: XX-XXX-2008*
Core and Builtins
-----------------
@ -46,6 +46,7 @@ Extension Modules
- Issue #1762972: Readded the reload() function as imp.reload()
Library
-------
@ -56,6 +57,13 @@ Library
- Issue #1578: Problems in win_getpass.
Build
-----
- Renamed --enable-unicode configure flag to --with-wide-unicode, since
Unicode strings can't be disabled anymore.
C API
-----
@ -143,12 +151,12 @@ Library
- Removed all types from the 'types' module that are easily accessable through
builtins.
What's New in Python 3.0a1?
==========================
*Release date: 31-Aug-2007*
Core and Builtins
-----------------

View File

@ -58,7 +58,6 @@
#define WITH_DOC_STRINGS 1
/* Unicode related */
#define Py_USING_UNICODE 1
#define PY_UNICODE_TYPE wchar_t
#define Py_UNICODE_SIZE SIZEOF_SHORT

View File

@ -80,7 +80,6 @@
/* #define SIZEOF_LONG_LONG 8 */ /* Count of Bytes in a (long long) */
/* unicode definines */
#define Py_USING_UNICODE
#define PY_UNICODE_TYPE wchar_t
#define Py_UNICODE_SIZE SIZEOF_SHORT

View File

@ -218,10 +218,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
assert(tok->cur - tok->buf < INT_MAX);
err_ret->offset = (int)(tok->cur - tok->buf);
len = tok->inp - tok->buf;
#ifdef Py_USING_UNICODE
text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset);
#endif
if (text == NULL) {
text = (char *) PyObject_MALLOC(len + 1);
if (text != NULL) {

68
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 59625 .
# From configure.in Revision: 59826 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.0.
#
@ -728,7 +728,6 @@ HAVE_GETHOSTBYNAME_R
HAVE_GETHOSTBYNAME
LIBM
LIBC
UNICODE_OBJS
THREADHEADERS
SRCDIRS
LTLIBOBJS'
@ -1321,8 +1320,6 @@ Optional Features:
--enable-toolbox-glue disable/enable MacOSX glue code for extensions
--enable-ipv6 Enable ipv6 (with ipv4) support
--disable-ipv6 Disable ipv6 support
--enable-unicode[=ucs[24]]
Enable Unicode strings (default is yes)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -1349,6 +1346,7 @@ Optional Packages:
--with-fpectl enable SIGFPE catching
--with-libm=STRING math library
--with-libc=STRING C library
--with-wide-unicode Use 4-byte Unicode characters (default is 2 bytes)
Some influential environment variables:
CC C compiler command
@ -21481,61 +21479,43 @@ fi
echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; }
fi
{ echo "$as_me:$LINENO: checking what type to use for unicode" >&5
echo $ECHO_N "checking what type to use for unicode... $ECHO_C" >&6; }
# Check whether --enable-unicode was given.
if test "${enable_unicode+set}" = set; then
enableval=$enable_unicode;
{ echo "$as_me:$LINENO: checking what type to use for str" >&5
echo $ECHO_N "checking what type to use for str... $ECHO_C" >&6; }
# Check whether --with-wide-unicode was given.
if test "${with_wide_unicode+set}" = set; then
withval=$with_wide_unicode;
if test "$withval" != no
then unicode_size="4"
else unicode_size="2"
fi
else
enable_unicode=yes
fi
if test $enable_unicode = yes
then
# Without any arguments, Py_UNICODE defaults to two-byte mode
case "$have_ucs4_tcl" in
yes) enable_unicode="ucs4"
;;
*) enable_unicode="ucs2"
;;
yes) unicode_size="4" ;;
*) unicode_size="2" ;;
esac
fi
case "$enable_unicode" in
ucs2) unicode_size="2"
cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 2
_ACEOF
;;
ucs4) unicode_size="4"
cat >>confdefs.h <<\_ACEOF
case "$unicode_size" in
4) cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 4
_ACEOF
;;
*) cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 2
_ACEOF
;;
esac
if test "$enable_unicode" = "no"
then
UNICODE_OBJS=""
{ echo "$as_me:$LINENO: result: not used" >&5
echo "${ECHO_T}not used" >&6; }
else
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
cat >>confdefs.h <<\_ACEOF
#define Py_USING_UNICODE 1
_ACEOF
# wchar_t is only usable if it maps to an unsigned type
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
-a "$ac_cv_wchar_t_signed" = "no"
@ -21569,7 +21549,6 @@ _ACEOF
fi
{ echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5
echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; }
fi
# check for endianness
{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
@ -24432,13 +24411,12 @@ HAVE_GETHOSTBYNAME_R!$HAVE_GETHOSTBYNAME_R$ac_delim
HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim
LIBM!$LIBM$ac_delim
LIBC!$LIBC$ac_delim
UNICODE_OBJS!$UNICODE_OBJS$ac_delim
THREADHEADERS!$THREADHEADERS$ac_delim
SRCDIRS!$SRCDIRS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -3004,48 +3004,32 @@ then
AC_MSG_RESULT($ac_cv_wchar_t_signed)
fi
AC_MSG_CHECKING(what type to use for unicode)
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
AC_ARG_ENABLE(unicode,
AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
[],
[enable_unicode=yes])
if test $enable_unicode = yes
then
# Without any arguments, Py_UNICODE defaults to two-byte mode
case "$have_ucs4_tcl" in
yes) enable_unicode="ucs4"
;;
*) enable_unicode="ucs2"
;;
esac
AC_MSG_CHECKING(what type to use for str)
AC_ARG_WITH(wide-unicode,
AC_HELP_STRING(--with-wide-unicode, Use 4-byte Unicode characters (default is 2 bytes)),
[
if test "$withval" != no
then unicode_size="4"
else unicode_size="2"
fi
],
[
case "$have_ucs4_tcl" in
yes) unicode_size="4" ;;
*) unicode_size="2" ;;
esac
])
AH_TEMPLATE(Py_UNICODE_SIZE,
[Define as the size of the unicode type.])
case "$enable_unicode" in
ucs2) unicode_size="2"
AC_DEFINE(Py_UNICODE_SIZE,2)
;;
ucs4) unicode_size="4"
AC_DEFINE(Py_UNICODE_SIZE,4)
;;
case "$unicode_size" in
4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;;
*) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
esac
AH_TEMPLATE(PY_UNICODE_TYPE,
[Define as the integral type used for Unicode representation.])
AC_SUBST(UNICODE_OBJS)
if test "$enable_unicode" = "no"
then
UNICODE_OBJS=""
AC_MSG_RESULT(not used)
else
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
AC_DEFINE(Py_USING_UNICODE, 1,
[Define if you want to have a Unicode type.])
# wchar_t is only usable if it maps to an unsigned type
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
-a "$ac_cv_wchar_t_signed" = "no"
@ -3068,7 +3052,6 @@ else
PY_UNICODE_TYPE="no type found"
fi
AC_MSG_RESULT($PY_UNICODE_TYPE)
fi
# check for endianness
AC_C_BIGENDIAN

View File

@ -821,9 +821,6 @@
/* Define as the size of the unicode type. */
#undef Py_UNICODE_SIZE
/* Define if you want to have a Unicode type. */
#undef Py_USING_UNICODE
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE