diff --git a/Include/Python.h b/Include/Python.h index 9379c6639c2..c28c23cf3f1 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 diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 95120596175..2d695706f5b 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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;