7457
* Report a Python member function with an unexpected return type.
7457
* Report a Python member function with an unexpected result.
7459
7459
static void sip_api_bad_catcher_result(PyObject *method)
7461
PyObject *mname, *etype, *evalue, *etraceback;
7464
* Get the current exception object if there is one. Its string
7465
* representation will be used as the detail of a new exception.
7467
PyErr_Fetch(&etype, &evalue, &etraceback);
7468
PyErr_NormalizeException(&etype, &evalue, &etraceback);
7470
Py_XDECREF(etraceback);
7464
7473
* This is part of the public API so we make no assumptions about the
7477
7486
mname = ((PyFunctionObject *)PyMethod_GET_FUNCTION(method))->func_name;
7479
#if PY_MAJOR_VERSION >= 3
7480
PyErr_Format(PyExc_TypeError, "invalid result type from %s.%U()",
7481
Py_TYPE(PyMethod_GET_SELF(method))->tp_name, mname);
7483
PyErr_Format(PyExc_TypeError, "invalid result type from %s.%s()",
7484
Py_TYPE(PyMethod_GET_SELF(method))->tp_name,
7485
PyString_AsString(mname));
7490
#if PY_MAJOR_VERSION >= 3
7491
PyErr_Format(PyExc_TypeError, "invalid result from %s.%U(), %S",
7492
Py_TYPE(PyMethod_GET_SELF(method))->tp_name, mname, evalue);
7494
PyObject *evalue_s = PyObject_Str(evalue);
7496
PyErr_Format(PyExc_TypeError, "invalid result from %s.%s(), %s",
7497
Py_TYPE(PyMethod_GET_SELF(method))->tp_name,
7498
PyString_AsString(mname), PyString_AsString(evalue_s));
7500
Py_XDECREF(evalue_s);
7507
#if PY_MAJOR_VERSION >= 3
7508
PyErr_Format(PyExc_TypeError, "invalid result from %s.%U()",
7509
Py_TYPE(PyMethod_GET_SELF(method))->tp_name, mname);
7511
PyErr_Format(PyExc_TypeError, "invalid result from %s.%s()",
7512
Py_TYPE(PyMethod_GET_SELF(method))->tp_name,
7513
PyString_AsString(mname));
8520
assert(sipTypeIsClass(td) || sipTypeIsMapped(td));
8549
assert(td == NULL || sipTypeIsClass(td) || sipTypeIsMapped(td));
8522
/* None is handled outside the type checkers. */
8523
if (pyObj == Py_None)
8554
* The type must be /External/ and the module that contains the
8555
* implementation hasn't been imported.
8559
else if (pyObj == Py_None)
8525
8561
/* If the type explicitly handles None then ignore the flags. */
8526
8562
if (sipTypeAllowNone(td))
10623
10659
vret = sipSimpleWrapper_clear(sw);
10625
10661
/* Remove any slots connected via a proxy. */
10626
if (sipQtSupport != NULL && sipPossibleProxy(sw))
10662
if (sipQtSupport != NULL && sipPossibleProxy(sw) && !sipNotInMap(sw))
10628
10664
void *tx = sip_api_get_address(sw);
10682
10718
if ((vret = sipSimpleWrapper_traverse(sw, visit, arg)) != 0)
10685
/* This should be handwritten code in PyQt. */
10686
if (sipQtSupport != NULL && sipQtSupport->qt_find_sipslot)
10722
* This should be handwritten code in PyQt. The map check is a bit of a
10723
* hack to work around PyQt4 problems with qApp and a user created
10724
* instance. qt_find_sipslot() will return the same slot information for
10725
* both causing the gc module to trigger assert() failures.
10727
if (sipQtSupport != NULL && sipQtSupport->qt_find_sipslot && !sipNotInMap(sw))
10688
10729
void *tx = sip_api_get_address(sw);