Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52d168a

Browse files
committed
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.
1 parent 22ec03c commit 52d168a

9 files changed

Lines changed: 92 additions & 131 deletions

File tree

Doc/library/codecs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ Encodings and Unicode
751751

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

Makefile.pre.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ DYNLOADFILE= @DYNLOADFILE@
171171
MACHDEP_OBJS= @MACHDEP_OBJS@
172172
LIBOBJDIR= Python/
173173
LIBOBJS= @LIBOBJS@
174-
UNICODE_OBJS= @UNICODE_OBJS@
175174

176175
PYTHON= python$(EXE)
177176
BUILDPYTHON= python$(BUILDEXE)
@@ -320,8 +319,9 @@ OBJECT_OBJS= \
320319
Objects/structseq.o \
321320
Objects/tupleobject.o \
322321
Objects/typeobject.o \
323-
Objects/weakrefobject.o \
324-
$(UNICODE_OBJS)
322+
Objects/unicodeobject.o \
323+
Objects/unicodectype.o \
324+
Objects/weakrefobject.o
325325

326326

327327
##########################################################################

Misc/NEWS

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Python News
77
What's New in Python 3.0a3?
88
===========================
99

10-
*Release data: XX-XXX-2008*
10+
*Release date: XX-XXX-2008*
1111

1212
Core and Builtins
1313
-----------------
@@ -46,6 +46,7 @@ Extension Modules
4646

4747
- Issue #1762972: Readded the reload() function as imp.reload()
4848

49+
4950
Library
5051
-------
5152

@@ -56,6 +57,13 @@ Library
5657
- Issue #1578: Problems in win_getpass.
5758

5859

60+
Build
61+
-----
62+
63+
- Renamed --enable-unicode configure flag to --with-wide-unicode, since
64+
Unicode strings can't be disabled anymore.
65+
66+
5967
C API
6068
-----
6169

@@ -143,12 +151,12 @@ Library
143151
- Removed all types from the 'types' module that are easily accessable through
144152
builtins.
145153

154+
146155
What's New in Python 3.0a1?
147156
==========================
148157

149158
*Release date: 31-Aug-2007*
150159

151-
152160
Core and Builtins
153161
-----------------
154162

PC/os2emx/pyconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
#define WITH_DOC_STRINGS 1
5959

6060
/* Unicode related */
61-
#define Py_USING_UNICODE 1
6261
#define PY_UNICODE_TYPE wchar_t
6362
#define Py_UNICODE_SIZE SIZEOF_SHORT
6463

PC/os2vacpp/pyconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
/* #define SIZEOF_LONG_LONG 8 */ /* Count of Bytes in a (long long) */
8181

8282
/* unicode definines */
83-
#define Py_USING_UNICODE
8483
#define PY_UNICODE_TYPE wchar_t
8584
#define Py_UNICODE_SIZE SIZEOF_SHORT
8685

Parser/parsetok.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
218218
assert(tok->cur - tok->buf < INT_MAX);
219219
err_ret->offset = (int)(tok->cur - tok->buf);
220220
len = tok->inp - tok->buf;
221-
#ifdef Py_USING_UNICODE
222221
text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset);
223-
224-
#endif
225222
if (text == NULL) {
226223
text = (char *) PyObject_MALLOC(len + 1);
227224
if (text != NULL) {

configure

Lines changed: 42 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 59625 .
2+
# From configure.in Revision: 59826 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.61 for python 3.0.
55
#
@@ -728,7 +728,6 @@ HAVE_GETHOSTBYNAME_R
728728
HAVE_GETHOSTBYNAME
729729
LIBM
730730
LIBC
731-
UNICODE_OBJS
732731
THREADHEADERS
733732
SRCDIRS
734733
LTLIBOBJS'
@@ -1321,8 +1320,6 @@ Optional Features:
13211320
--enable-toolbox-glue disable/enable MacOSX glue code for extensions
13221321
--enable-ipv6 Enable ipv6 (with ipv4) support
13231322
--disable-ipv6 Disable ipv6 support
1324-
--enable-unicode[=ucs[24]]
1325-
Enable Unicode strings (default is yes)
13261323

13271324
Optional Packages:
13281325
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1349,6 +1346,7 @@ Optional Packages:
13491346
--with-fpectl enable SIGFPE catching
13501347
--with-libm=STRING math library
13511348
--with-libc=STRING C library
1349+
--with-wide-unicode Use 4-byte Unicode characters (default is 2 bytes)
13521350

13531351
Some influential environment variables:
13541352
CC C compiler command
@@ -21481,95 +21479,76 @@ fi
2148121479
echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; }
2148221480
fi
2148321481

21484-
{ echo "$as_me:$LINENO: checking what type to use for unicode" >&5
21485-
echo $ECHO_N "checking what type to use for unicode... $ECHO_C" >&6; }
21486-
# Check whether --enable-unicode was given.
21487-
if test "${enable_unicode+set}" = set; then
21488-
enableval=$enable_unicode;
21489-
else
21490-
enable_unicode=yes
21482+
{ echo "$as_me:$LINENO: checking what type to use for str" >&5
21483+
echo $ECHO_N "checking what type to use for str... $ECHO_C" >&6; }
21484+
21485+
# Check whether --with-wide-unicode was given.
21486+
if test "${with_wide_unicode+set}" = set; then
21487+
withval=$with_wide_unicode;
21488+
if test "$withval" != no
21489+
then unicode_size="4"
21490+
else unicode_size="2"
2149121491
fi
2149221492

21493+
else
21494+
21495+
case "$have_ucs4_tcl" in
21496+
yes) unicode_size="4" ;;
21497+
*) unicode_size="2" ;;
21498+
esac
2149321499

21494-
if test $enable_unicode = yes
21495-
then
21496-
# Without any arguments, Py_UNICODE defaults to two-byte mode
21497-
case "$have_ucs4_tcl" in
21498-
yes) enable_unicode="ucs4"
21499-
;;
21500-
*) enable_unicode="ucs2"
21501-
;;
21502-
esac
2150321500
fi
2150421501

2150521502

2150621503

21507-
case "$enable_unicode" in
21508-
ucs2) unicode_size="2"
21509-
cat >>confdefs.h <<\_ACEOF
21510-
#define Py_UNICODE_SIZE 2
21511-
_ACEOF
2151221504

21513-
;;
21514-
ucs4) unicode_size="4"
21515-
cat >>confdefs.h <<\_ACEOF
21505+
case "$unicode_size" in
21506+
4) cat >>confdefs.h <<\_ACEOF
2151621507
#define Py_UNICODE_SIZE 4
2151721508
_ACEOF
21518-
21519-
;;
21509+
;;
21510+
*) cat >>confdefs.h <<\_ACEOF
21511+
#define Py_UNICODE_SIZE 2
21512+
_ACEOF
21513+
;;
2152021514
esac
2152121515

2152221516

2152321517

2152421518

21525-
21526-
if test "$enable_unicode" = "no"
21527-
then
21528-
UNICODE_OBJS=""
21529-
{ echo "$as_me:$LINENO: result: not used" >&5
21530-
echo "${ECHO_T}not used" >&6; }
21531-
else
21532-
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
21533-
21534-
cat >>confdefs.h <<\_ACEOF
21535-
#define Py_USING_UNICODE 1
21536-
_ACEOF
21537-
21538-
21539-
# wchar_t is only usable if it maps to an unsigned type
21540-
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
21519+
# wchar_t is only usable if it maps to an unsigned type
21520+
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
2154121521
-a "$ac_cv_wchar_t_signed" = "no"
21542-
then
21543-
PY_UNICODE_TYPE="wchar_t"
21522+
then
21523+
PY_UNICODE_TYPE="wchar_t"
2154421524

2154521525
cat >>confdefs.h <<\_ACEOF
2154621526
#define HAVE_USABLE_WCHAR_T 1
2154721527
_ACEOF
2154821528

21549-
cat >>confdefs.h <<\_ACEOF
21529+
cat >>confdefs.h <<\_ACEOF
2155021530
#define PY_UNICODE_TYPE wchar_t
2155121531
_ACEOF
2155221532

21553-
elif test "$ac_cv_sizeof_short" = "$unicode_size"
21554-
then
21555-
PY_UNICODE_TYPE="unsigned short"
21556-
cat >>confdefs.h <<\_ACEOF
21533+
elif test "$ac_cv_sizeof_short" = "$unicode_size"
21534+
then
21535+
PY_UNICODE_TYPE="unsigned short"
21536+
cat >>confdefs.h <<\_ACEOF
2155721537
#define PY_UNICODE_TYPE unsigned short
2155821538
_ACEOF
2155921539

21560-
elif test "$ac_cv_sizeof_long" = "$unicode_size"
21561-
then
21562-
PY_UNICODE_TYPE="unsigned long"
21563-
cat >>confdefs.h <<\_ACEOF
21540+
elif test "$ac_cv_sizeof_long" = "$unicode_size"
21541+
then
21542+
PY_UNICODE_TYPE="unsigned long"
21543+
cat >>confdefs.h <<\_ACEOF
2156421544
#define PY_UNICODE_TYPE unsigned long
2156521545
_ACEOF
2156621546

21567-
else
21568-
PY_UNICODE_TYPE="no type found"
21569-
fi
21570-
{ echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5
21571-
echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; }
21547+
else
21548+
PY_UNICODE_TYPE="no type found"
2157221549
fi
21550+
{ echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5
21551+
echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; }
2157321552

2157421553
# check for endianness
2157521554
{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
@@ -24432,13 +24411,12 @@ HAVE_GETHOSTBYNAME_R!$HAVE_GETHOSTBYNAME_R$ac_delim
2443224411
HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim
2443324412
LIBM!$LIBM$ac_delim
2443424413
LIBC!$LIBC$ac_delim
24435-
UNICODE_OBJS!$UNICODE_OBJS$ac_delim
2443624414
THREADHEADERS!$THREADHEADERS$ac_delim
2443724415
SRCDIRS!$SRCDIRS$ac_delim
2443824416
LTLIBOBJS!$LTLIBOBJS$ac_delim
2443924417
_ACEOF
2444024418

24441-
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then
24419+
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then
2444224420
break
2444324421
elif $ac_last_try; then
2444424422
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

configure.in

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,72 +3003,55 @@ then
30033003
ac_cv_wchar_t_signed=yes)])
30043004
AC_MSG_RESULT($ac_cv_wchar_t_signed)
30053005
fi
3006-
3007-
AC_MSG_CHECKING(what type to use for unicode)
3008-
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3009-
AC_ARG_ENABLE(unicode,
3010-
AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3011-
[],
3012-
[enable_unicode=yes])
30133006

3014-
if test $enable_unicode = yes
3015-
then
3016-
# Without any arguments, Py_UNICODE defaults to two-byte mode
3017-
case "$have_ucs4_tcl" in
3018-
yes) enable_unicode="ucs4"
3019-
;;
3020-
*) enable_unicode="ucs2"
3021-
;;
3022-
esac
3007+
AC_MSG_CHECKING(what type to use for str)
3008+
AC_ARG_WITH(wide-unicode,
3009+
AC_HELP_STRING(--with-wide-unicode, Use 4-byte Unicode characters (default is 2 bytes)),
3010+
[
3011+
if test "$withval" != no
3012+
then unicode_size="4"
3013+
else unicode_size="2"
30233014
fi
3015+
],
3016+
[
3017+
case "$have_ucs4_tcl" in
3018+
yes) unicode_size="4" ;;
3019+
*) unicode_size="2" ;;
3020+
esac
3021+
])
30243022

30253023
AH_TEMPLATE(Py_UNICODE_SIZE,
30263024
[Define as the size of the unicode type.])
3027-
case "$enable_unicode" in
3028-
ucs2) unicode_size="2"
3029-
AC_DEFINE(Py_UNICODE_SIZE,2)
3030-
;;
3031-
ucs4) unicode_size="4"
3032-
AC_DEFINE(Py_UNICODE_SIZE,4)
3033-
;;
3025+
case "$unicode_size" in
3026+
4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;;
3027+
*) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
30343028
esac
30353029

30363030
AH_TEMPLATE(PY_UNICODE_TYPE,
30373031
[Define as the integral type used for Unicode representation.])
30383032

3039-
AC_SUBST(UNICODE_OBJS)
3040-
if test "$enable_unicode" = "no"
3033+
# wchar_t is only usable if it maps to an unsigned type
3034+
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3035+
-a "$ac_cv_wchar_t_signed" = "no"
30413036
then
3042-
UNICODE_OBJS=""
3043-
AC_MSG_RESULT(not used)
3037+
PY_UNICODE_TYPE="wchar_t"
3038+
AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3039+
[Define if you have a useable wchar_t type defined in wchar.h; useable
3040+
means wchar_t must be an unsigned type with at least 16 bits. (see
3041+
Include/unicodeobject.h).])
3042+
AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3043+
elif test "$ac_cv_sizeof_short" = "$unicode_size"
3044+
then
3045+
PY_UNICODE_TYPE="unsigned short"
3046+
AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3047+
elif test "$ac_cv_sizeof_long" = "$unicode_size"
3048+
then
3049+
PY_UNICODE_TYPE="unsigned long"
3050+
AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
30443051
else
3045-
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3046-
AC_DEFINE(Py_USING_UNICODE, 1,
3047-
[Define if you want to have a Unicode type.])
3048-
3049-
# wchar_t is only usable if it maps to an unsigned type
3050-
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3051-
-a "$ac_cv_wchar_t_signed" = "no"
3052-
then
3053-
PY_UNICODE_TYPE="wchar_t"
3054-
AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3055-
[Define if you have a useable wchar_t type defined in wchar.h; useable
3056-
means wchar_t must be an unsigned type with at least 16 bits. (see
3057-
Include/unicodeobject.h).])
3058-
AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3059-
elif test "$ac_cv_sizeof_short" = "$unicode_size"
3060-
then
3061-
PY_UNICODE_TYPE="unsigned short"
3062-
AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3063-
elif test "$ac_cv_sizeof_long" = "$unicode_size"
3064-
then
3065-
PY_UNICODE_TYPE="unsigned long"
3066-
AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3067-
else
3068-
PY_UNICODE_TYPE="no type found"
3069-
fi
3070-
AC_MSG_RESULT($PY_UNICODE_TYPE)
3052+
PY_UNICODE_TYPE="no type found"
30713053
fi
3054+
AC_MSG_RESULT($PY_UNICODE_TYPE)
30723055

30733056
# check for endianness
30743057
AC_C_BIGENDIAN

0 commit comments

Comments
 (0)