respect __nonzero__

This commit is contained in:
David Rose 2009-08-05 21:51:28 +00:00
parent 9f9316ff81
commit 0e773c8684

View File

@ -97,6 +97,7 @@ RenameSet methodRenameDictionary[] = {
{ "operator <<=" , "__ilshift__", 1 },
{ "operator >>=" , "__irshift__", 1 },
{ "operator typecast bool", "__nonzero__", 0 },
{ "__nonzero__" , "__nonzero__", 0 },
{ "print" , "Cprint", 0 },
{ "CInterval.set_t", "_priv__cSetT", 0 },
{ NULL, NULL, -1 }
@ -558,6 +559,12 @@ get_slotted_function_def(Object *obj, Function *func, SlottedFunctionDef &def) {
return true;
}
if (method_name == "__nonzero__") {
def._answer_location = "tp_as_number->nb_nonzero";
def._wrapper_type = WT_inquiry;
return true;
}
if (func->_ifunc.is_operator_typecast()) {
// A typecast operator. Check for a supported low-level typecast type.
if (!func->_remaps.empty()) {