summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-12-22 16:31:41 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-12-22 16:31:41 (GMT)
commitac4ea13a3aec87bf3e6ceb54e867e20f1fbd4253 (patch)
tree282c8755f1af5910caff13a369dd81c375a51408 /Include
parent66518bbb67ee5d4ba5c8ec314f2192e425a2d707 (diff)
downloadcpython-ac4ea13a3aec87bf3e6ceb54e867e20f1fbd4253.zip
cpython-ac4ea13a3aec87bf3e6ceb54e867e20f1fbd4253.tar.gz
cpython-ac4ea13a3aec87bf3e6ceb54e867e20f1fbd4253.tar.bz2
There are places in Python which assume bytes have 8-bits. Formalize that a
bit by checking the value of UCHAR_MAX in Include/Python.h. There was a check in Objects/stringobject.c. Remove that. (Note that we don't define UCHAR_MAX if it's not defined as the old test did.)
Diffstat (limited to 'Include')
-rw-r--r--Include/Python.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 9379c66..c28c23c 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -21,6 +21,14 @@
#error "limits.h is required by std C -- why isn't HAVE_LIMITS_H defined?"
#endif
+#ifndef UCHAR_MAX
+#error "Something's broken. UCHAR_MAX should be defined in limits.h."
+#endif
+
+#if UCHAR_MAX != 255
+#error "Python's source code currently assumes 8-bit characters."
+#endif
+
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
#define _SGI_MP_SOURCE
#endif