-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow T_BOOL in PyMemberDef definitions #44962
Comments
Hello The attached patch allows to use T_BOOL alongside other common types in the PyMemberDef definitions of your custom types. Usage example: typedef struct ButtonObject
{
PyObject_HEAD
char fToggled;
} ButtonObject; static PyMemberDef eb_ButtonEventMembers[] = {
}; The patch has been built against a plain Python 2.5 installation. |
I'd rather not allow any object to be assigned to the attribute, but only a bool. T_INT, for example, doesn't automatically call int() on its values too. |
allow or reject it for 2.6, Georg? |
The question is also what C type to assume for boolean fields -- char or |
It seems to me that, when a boolean is to be represented, most C As for type checking, Angelo's patch already does a PyBool_Check against |
Martin - is a char struct member for T_BOOL fine with you? |
I can't see anything wrong with the feature. Of course, the patch itself Ideally, there would also be changes to the documentation, but as I think the cast to long (in PyBool_FromLong) is redundant. |
Okay, added tests, removed the cast and committed in r60181. If I find |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: