Index: Python/structmember.c =================================================================== --- Python/structmember.c (revision 68) +++ Python/structmember.c (working copy) @@ -61,6 +61,9 @@ } addr += l->offset; switch (l->type) { + case T_BOOL: + v = PyBool_FromLong((long) *(char*)addr); + break; case T_BYTE: v = PyInt_FromLong( (long) (((*(char*)addr & 0xff) ^ 0x80) - 0x80)); @@ -175,6 +178,16 @@ } addr += l->offset; switch (l->type) { + case T_BOOL: + if (!PyBool_Check(v)) { + PyErr_BadArgument(); + return -1; + } + if (PyObject_IsTrue(v)) + *(char*)addr = (char) 1; + else + *(char*)addr = (char) 0; + break; case T_BYTE: case T_UBYTE: if (!PyInt_Check(v)) { Index: Include/structmember.h =================================================================== --- Include/structmember.h (revision 68) +++ Include/structmember.h (working copy) @@ -62,6 +62,9 @@ /* Added by Jack: strings contained in the structure */ #define T_STRING_INPLACE 13 +/* Added by Lillo: bools contained in the structure (assumed char) */ +#define T_BOOL 14 + #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError when the value is NULL, instead of converting to None. */