]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
There are places in Python which assume bytes have 8-bits. Formalize that a
authorSkip Montanaro <skip@pobox.com>
Mon, 22 Dec 2003 16:31:41 +0000 (16:31 +0000)
committerSkip Montanaro <skip@pobox.com>
Mon, 22 Dec 2003 16:31:41 +0000 (16:31 +0000)
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.)

Include/Python.h
Objects/stringobject.c

index 9379c6639c2ba8b379dc12e72b10bcd2d40981e7..c28c23cf3f19b3f6a3f6c16b1cde86d8d67547ca 100644 (file)
 #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
index 951205961755ecf01d92f53446a21ee9f36ac730..2d695706f5b66fd708cea99eda6bcc7505abb0fa 100644 (file)
@@ -8,10 +8,6 @@
 int null_strings, one_strings;
 #endif
 
-#if !defined(HAVE_LIMITS_H) && !defined(UCHAR_MAX)
-#define UCHAR_MAX 255
-#endif
-
 static PyStringObject *characters[UCHAR_MAX + 1];
 static PyStringObject *nullstring;