##// END OF EJS Templates
improved enum overload handling...
florianlink -
r57:50a844a82951
parent child
Show More
@@ -299,6 +299,7 return Py_None;
299 299 bool ok;
300 300 int value = PyObjGetInt(obj, true, ok);
301 301 if (ok && value==0) {
302 // TODOXXX is this wise? or should it be expected from the programmer to use None?
302 303 PythonQtValueStorage_ADD_VALUE_IF_NEEDED(alreadyAllocatedCPPObject,global_ptrStorage, void*, NULL, ptr);
303 304 }
304 305 }
@@ -460,12 +461,13 return Py_None;
460 461 if (info.enumWrapper) {
461 462 unsigned int val;
462 463 if ((PyObject*)obj->ob_type == info.enumWrapper) {
463 // we have a direct enum type match:
464 // we have a exact enum type match:
464 465 val = PyInt_AS_LONG(obj);
465 466 ok = true;
466 } else {
467 // we try to get an integer, and in strict mode, it may not be a derived int class, so that no other enum can be taken as an int
468 val = (unsigned int)PyObjGetLongLong(obj, strict, ok);
467 } else if (!strict) {
468 // we try to get any integer, when not being strict. If we are strict, integers are not wanted because
469 // we want an integer overload to be taken first!
470 val = (unsigned int)PyObjGetLongLong(obj, false, ok);
469 471 }
470 472 if (ok) {
471 473 PythonQtValueStorage_ADD_VALUE_IF_NEEDED(alreadyAllocatedCPPObject,global_valueStorage, unsigned int, val, ptr);
General Comments 0
You need to be logged in to leave comments. Login now