summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-04-16 20:34:55 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-04-16 20:34:55 (GMT)
commit6f29ff319b83c4e5cec1ddb06075d7a9da377a19 (patch)
tree4353d7cddb9db60461600297b3d88dffc82d3b00 /Modules/_tkinter.c
parent2cd0a65c708d6120487f161f9039b981a03ae20b (diff)
downloadcpython-6f29ff319b83c4e5cec1ddb06075d7a9da377a19.zip
cpython-6f29ff319b83c4e5cec1ddb06075d7a9da377a19.tar.gz
cpython-6f29ff319b83c4e5cec1ddb06075d7a9da377a19.tar.bz2
Support UCS-4 Tcl for UCS-4 Python builds. Fixes #719880.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 303119f..c946f88 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -87,8 +87,12 @@ Copyright (C) 1994 Steen Lumholt.
/* Unicode conversion assumes that Tcl_UniChar is two bytes.
We cannot test this directly, so we test UTF-8 size instead,
expecting that TCL_UTF_MAX is changed if Tcl ever supports
- either UTF-16 or UCS-4. */
-#if TCL_UTF_MAX != 3
+ either UTF-16 or UCS-4.
+ Redhat 8 sets TCL_UTF_MAX to 6, and uses wchar_t for
+ Tcl_Unichar. This is also ok as long as Python uses UCS-4,
+ as well.
+*/
+#if TCL_UTF_MAX != 3 && !(defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==6)
#error "unsupported Tcl configuration"
#endif
@@ -899,7 +903,7 @@ AsObj(PyObject *value)
int size = PyUnicode_GET_SIZE(value);
/* This #ifdef assumes that Tcl uses UCS-2.
See TCL_UTF_MAX test above. */
-#ifdef Py_UNICODE_WIDE
+#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
Tcl_UniChar *outbuf;
int i;
outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
@@ -1030,7 +1034,7 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
if (value->typePtr == app->StringType) {
#ifdef Py_USING_UNICODE
-#ifdef Py_UNICODE_WIDE
+#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==3
PyObject *result;
int size;
Tcl_UniChar *input;