This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lillo
Recipients
Date 2007-05-17.09:50:16
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Hello

The attached patch allows to use T_BOOL alongside other common types in the PyMemberDef definitions of your custom types.
The boolean value is assumed to be held in a straight C char variable, and PyMember_SetOne() sets it to 1 or 0 depending on the result of calling PyObject_IsTrue() on the passed value object.


Usage example:


typedef struct ButtonObject
{
	PyObject_HEAD
	char		fToggled;
} ButtonObject;


static PyMemberDef eb_ButtonEventMembers[] = {

	{ "toggled", T_BOOL, offsetof(ButtonObject, fToggled), RO, "True if the button is currently toggled" },
	{ NULL, 0, 0, 0, NULL }
};



The patch has been built against a plain Python 2.5 installation.
History
Date User Action Args
2007-08-23 15:58:28adminlinkissue1720595 messages
2007-08-23 15:58:28admincreate