add Py_CHARMASK
diff --git a/Include/allobjects.h b/Include/allobjects.h
index 5ce324d..34b3816 100644
--- a/Include/allobjects.h
+++ b/Include/allobjects.h
@@ -82,6 +82,14 @@
#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
#define PyArg_NoArgs(v) PyArg_Parse(v, "")
+/* Convert a possibly signed character to a nonnegative int */
+/* XXX This assumes characters are 8 bits wide */
+#ifdef __CHAR_UNSIGNED__
+#define Py_CHARMASK(c) (c)
+#else
+#define Py_CHARMASK(c) ((c) & 0xff)
+#endif
+
#ifdef __cplusplus
}
#endif