|
|
@ -1,18 +1,18 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* SIP library code.
|
|
|
|
* SIP-TQt library code.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 Riverbank Computing Limited <info@riverbankcomputing.com>
|
|
|
|
* Copyright (c) 2010 Riverbank Computing Limited <info@riverbankcomputing.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This file is part of SIP.
|
|
|
|
* This file is part of SIP-TQt.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This copy of SIP is licensed for use under the terms of the SIP License
|
|
|
|
* This copy of SIP-TQt is licensed for use under the terms of the SIP License
|
|
|
|
* Agreement. See the file LICENSE for more details.
|
|
|
|
* Agreement. See the file LICENSE for more details.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This copy of SIP may also used under the terms of the GNU General Public
|
|
|
|
* This copy of SIP-TQt may also used under the terms of the GNU General Public
|
|
|
|
* License v2 or v3 as published by the Free Software Foundation which can be
|
|
|
|
* License v2 or v3 as published by the Free Software Foundation which can be
|
|
|
|
* found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package.
|
|
|
|
* found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "sip.h"
|
|
|
|
#include "sip-tqt.h"
|
|
|
|
#include "sipint.h"
|
|
|
|
#include "sipint.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -51,7 +51,7 @@ static int sipWrapperType_setattro(PyObject *self, PyObject *name,
|
|
|
|
|
|
|
|
|
|
|
|
static PyTypeObject sipWrapperType_Type = {
|
|
|
|
static PyTypeObject sipWrapperType_Type = {
|
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
|
|
"sip.wrappertype", /* tp_name */
|
|
|
|
"sip_tqt.wrappertype", /* tp_name */
|
|
|
|
sizeof (sipWrapperType), /* tp_basicsize */
|
|
|
|
sizeof (sipWrapperType), /* tp_basicsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_dealloc */
|
|
|
|
0, /* tp_dealloc */
|
|
|
@ -107,7 +107,7 @@ static sipWrapperType sipWrapper_Type = {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0)
|
|
|
|
PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0)
|
|
|
|
"sip.wrapper", /* tp_name */
|
|
|
|
"sip_tqt.wrapper", /* tp_name */
|
|
|
|
sizeof (sipWrapper), /* tp_basicsize */
|
|
|
|
sizeof (sipWrapper), /* tp_basicsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
(destructor)sipWrapper_dealloc, /* tp_dealloc */
|
|
|
|
(destructor)sipWrapper_dealloc, /* tp_dealloc */
|
|
|
@ -254,7 +254,7 @@ static void sip_api_add_exception(sipErrorState es, PyObject **parseErrp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* The data structure that represents the SIP API.
|
|
|
|
* The data structure that represents the SIP-TQt API.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static const sipAPIDef sip_api = {
|
|
|
|
static const sipAPIDef sip_api = {
|
|
|
|
/* This must be first. */
|
|
|
|
/* This must be first. */
|
|
|
@ -453,7 +453,7 @@ static PyObject *sipEnumType_alloc(PyTypeObject *self, SIP_SSIZE_T nitems);
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static PyTypeObject sipEnumType_Type = {
|
|
|
|
static PyTypeObject sipEnumType_Type = {
|
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
|
|
"sip.enumtype", /* tp_name */
|
|
|
|
"sip_tqt.enumtype", /* tp_name */
|
|
|
|
sizeof (sipEnumTypeObject), /* tp_basicsize */
|
|
|
|
sizeof (sipEnumTypeObject), /* tp_basicsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_dealloc */
|
|
|
|
0, /* tp_dealloc */
|
|
|
@ -654,13 +654,13 @@ static PyObject *bad_type_str(int arg_nr, PyObject *arg);
|
|
|
|
* The Python module initialisation function.
|
|
|
|
* The Python module initialisation function.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#define SIP_MODULE_ENTRY PyInit_sip
|
|
|
|
#define SIP_MODULE_ENTRY PyInit_sip_tqt
|
|
|
|
#define SIP_MODULE_TYPE PyObject *
|
|
|
|
#define SIP_MODULE_TYPE PyObject *
|
|
|
|
#define SIP_MODULE_DISCARD(m) Py_DECREF(m)
|
|
|
|
#define SIP_MODULE_DISCARD(m) Py_DECREF(m)
|
|
|
|
#define SIP_FATAL(s) return NULL
|
|
|
|
#define SIP_FATAL(s) return NULL
|
|
|
|
#define SIP_MODULE_RETURN(m) return (m)
|
|
|
|
#define SIP_MODULE_RETURN(m) return (m)
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define SIP_MODULE_ENTRY initsip
|
|
|
|
#define SIP_MODULE_ENTRY initsip_tqt
|
|
|
|
#define SIP_MODULE_TYPE void
|
|
|
|
#define SIP_MODULE_TYPE void
|
|
|
|
#define SIP_MODULE_DISCARD(m)
|
|
|
|
#define SIP_MODULE_DISCARD(m)
|
|
|
|
#define SIP_FATAL(s) Py_FatalError(s)
|
|
|
|
#define SIP_FATAL(s) Py_FatalError(s)
|
|
|
@ -695,7 +695,7 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
static PyModuleDef module_def = {
|
|
|
|
static PyModuleDef module_def = {
|
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
|
"sip", /* m_name */
|
|
|
|
"sip_tqt", /* m_name */
|
|
|
|
NULL, /* m_doc */
|
|
|
|
NULL, /* m_doc */
|
|
|
|
-1, /* m_size */
|
|
|
|
-1, /* m_size */
|
|
|
|
methods, /* m_methods */
|
|
|
|
methods, /* m_methods */
|
|
|
@ -717,13 +717,13 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
sipWrapperType_Type.tp_base = &PyType_Type;
|
|
|
|
sipWrapperType_Type.tp_base = &PyType_Type;
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready(&sipWrapperType_Type) < 0)
|
|
|
|
if (PyType_Ready(&sipWrapperType_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.wrappertype type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.wrappertype type");
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready((PyTypeObject *)&sipSimpleWrapper_Type) < 0)
|
|
|
|
if (PyType_Ready((PyTypeObject *)&sipSimpleWrapper_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.simplewrapper type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.simplewrapper type");
|
|
|
|
|
|
|
|
|
|
|
|
if (sip_api_register_py_type((PyTypeObject *)&sipSimpleWrapper_Type) < 0)
|
|
|
|
if (sip_api_register_py_type((PyTypeObject *)&sipSimpleWrapper_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to register sip.simplewrapper type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to register sip_tqt.simplewrapper type");
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(STACKLESS)
|
|
|
|
#if defined(STACKLESS)
|
|
|
|
sipWrapper_Type.super.tp_base = (PyTypeObject *)&sipSimpleWrapper_Type;
|
|
|
|
sipWrapper_Type.super.tp_base = (PyTypeObject *)&sipSimpleWrapper_Type;
|
|
|
@ -734,30 +734,30 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready((PyTypeObject *)&sipWrapper_Type) < 0)
|
|
|
|
if (PyType_Ready((PyTypeObject *)&sipWrapper_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.wrapper type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.wrapper type");
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready(&sipMethodDescr_Type) < 0)
|
|
|
|
if (PyType_Ready(&sipMethodDescr_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.methoddescriptor type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.methoddescriptor type");
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready(&sipVariableDescr_Type) < 0)
|
|
|
|
if (PyType_Ready(&sipVariableDescr_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.variabledescriptor type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.variabledescriptor type");
|
|
|
|
|
|
|
|
|
|
|
|
sipEnumType_Type.tp_base = &PyType_Type;
|
|
|
|
sipEnumType_Type.tp_base = &PyType_Type;
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready(&sipEnumType_Type) < 0)
|
|
|
|
if (PyType_Ready(&sipEnumType_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.enumtype type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.enumtype type");
|
|
|
|
|
|
|
|
|
|
|
|
if (PyType_Ready(&sipVoidPtr_Type) < 0)
|
|
|
|
if (PyType_Ready(&sipVoidPtr_Type) < 0)
|
|
|
|
SIP_FATAL("sip: Failed to initialise sip.voidptr type");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.voidptr type");
|
|
|
|
|
|
|
|
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
mod = PyModule_Create(&module_def);
|
|
|
|
mod = PyModule_Create(&module_def);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
mod = Py_InitModule("sip", methods);
|
|
|
|
mod = Py_InitModule("sip_tqt", methods);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (mod == NULL)
|
|
|
|
if (mod == NULL)
|
|
|
|
SIP_FATAL("sip: Failed to intialise sip module");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to intialise sip_tqt module");
|
|
|
|
|
|
|
|
|
|
|
|
mod_dict = PyModule_GetDict(mod);
|
|
|
|
mod_dict = PyModule_GetDict(mod);
|
|
|
|
|
|
|
|
|
|
|
@ -768,12 +768,12 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
if (type_unpickler == NULL || enum_unpickler == NULL)
|
|
|
|
if (type_unpickler == NULL || enum_unpickler == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_FATAL("sip: Failed to get pickle helpers");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to get pickle helpers");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Publish the SIP API. */
|
|
|
|
/* Publish the SIP-TQt API. */
|
|
|
|
#if defined(SIP_USE_PYCAPSULE)
|
|
|
|
#if defined(SIP_USE_PYCAPSULE)
|
|
|
|
obj = PyCapsule_New((void *)&sip_api, "sip._C_API", NULL);
|
|
|
|
obj = PyCapsule_New((void *)&sip_api, "sip_tqt._C_API", NULL);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
obj = PyCObject_FromVoidPtr((void *)&sip_api, NULL);
|
|
|
|
obj = PyCObject_FromVoidPtr((void *)&sip_api, NULL);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -781,7 +781,7 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
if (obj == NULL)
|
|
|
|
if (obj == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_FATAL("sip: Failed to create _C_API object");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to create _C_API object");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rc = PyDict_SetItemString(mod_dict, "_C_API", obj);
|
|
|
|
rc = PyDict_SetItemString(mod_dict, "_C_API", obj);
|
|
|
@ -790,31 +790,31 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
|
|
|
if (rc < 0)
|
|
|
|
if (rc < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_MODULE_DISCARD(mod);
|
|
|
|
SIP_FATAL("sip: Failed to add _C_API object to module dictionary");
|
|
|
|
SIP_FATAL("sip-tqt: Failed to add _C_API object to module dictionary");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add the SIP version number, but don't worry about errors. */
|
|
|
|
/* Add the SIP-TQt version number, but don't worry about errors. */
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
obj = PyLong_FromLong(SIP_VERSION);
|
|
|
|
obj = PyLong_FromLong(SIP_TQT_VERSION);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
obj = PyInt_FromLong(SIP_VERSION);
|
|
|
|
obj = PyInt_FromLong(SIP_TQT_VERSION);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (obj != NULL)
|
|
|
|
if (obj != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyDict_SetItemString(mod_dict, "SIP_VERSION", obj);
|
|
|
|
PyDict_SetItemString(mod_dict, "SIP_TQT_VERSION", obj);
|
|
|
|
Py_DECREF(obj);
|
|
|
|
Py_DECREF(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
|
|
obj = PyUnicode_FromString(SIP_VERSION_STR);
|
|
|
|
obj = PyUnicode_FromString(SIP_TQT_VERSION_STR);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
obj = PyString_FromString(SIP_VERSION_STR);
|
|
|
|
obj = PyString_FromString(SIP_TQT_VERSION_STR);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (obj != NULL)
|
|
|
|
if (obj != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyDict_SetItemString(mod_dict, "SIP_VERSION_STR", obj);
|
|
|
|
PyDict_SetItemString(mod_dict, "SIP_TQT_VERSION_STR", obj);
|
|
|
|
Py_DECREF(obj);
|
|
|
|
Py_DECREF(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1009,7 +1009,7 @@ static PyObject *cast(PyObject *self, PyObject *args)
|
|
|
|
td = wt->type;
|
|
|
|
td = wt->type;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_SetString(PyExc_TypeError, "argument 1 of sip.cast() must be an instance of a sub or super-type of argument 2");
|
|
|
|
PyErr_SetString(PyExc_TypeError, "argument 1 of sip_tqt.cast() must be an instance of a sub or super-type of argument 2");
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1175,17 +1175,17 @@ static int sip_api_export_module(sipExportedModuleDef *client,
|
|
|
|
|
|
|
|
|
|
|
|
/* Check that we can support it. */
|
|
|
|
/* Check that we can support it. */
|
|
|
|
|
|
|
|
|
|
|
|
if (api_major != SIP_API_MAJOR_NR || api_minor > SIP_API_MINOR_NR)
|
|
|
|
if (api_major != SIP_TQT_API_MAJOR_NR || api_minor > SIP_TQT_API_MINOR_NR)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if SIP_API_MINOR_NR > 0
|
|
|
|
#if SIP_TQT_API_MINOR_NR > 0
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
"the sip module implements API v%d.0 to v%d.%d but the %s module requires API v%d.%d",
|
|
|
|
"the sip_tqt module implements API v%d.0 to v%d.%d but the %s module requires API v%d.%d",
|
|
|
|
SIP_API_MAJOR_NR, SIP_API_MAJOR_NR, SIP_API_MINOR_NR,
|
|
|
|
SIP_TQT_API_MAJOR_NR, SIP_TQT_API_MAJOR_NR, SIP_TQT_API_MINOR_NR,
|
|
|
|
full_name, api_major, api_minor);
|
|
|
|
full_name, api_major, api_minor);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
"the sip module implements API v%d.0 but the %s module requires API v%d.%d",
|
|
|
|
"the sip_tqt module implements API v%d.0 but the %s module requires API v%d.%d",
|
|
|
|
SIP_API_MAJOR_NR, full_name, api_major, api_minor);
|
|
|
|
SIP_TQT_API_MAJOR_NR, full_name, api_major, api_minor);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -1210,7 +1210,7 @@ static int sip_api_export_module(sipExportedModuleDef *client,
|
|
|
|
if (em == NULL)
|
|
|
|
if (em == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
"the %s module failed to register with the sip module",
|
|
|
|
"the %s module failed to register with the sip_tqt module",
|
|
|
|
im->im_name);
|
|
|
|
im->im_name);
|
|
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -1237,11 +1237,11 @@ static int sip_api_export_module(sipExportedModuleDef *client,
|
|
|
|
|
|
|
|
|
|
|
|
for (em = moduleList; em != NULL; em = em->em_next)
|
|
|
|
for (em = moduleList; em != NULL; em = em->em_next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* SIP clients must have unique names. */
|
|
|
|
/* SIP-TQt clients must have unique names. */
|
|
|
|
if (strcmp(sipNameOfModule(em), full_name) == 0)
|
|
|
|
if (strcmp(sipNameOfModule(em), full_name) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
"the sip module has already registered a module called %s",
|
|
|
|
"the sip_tqt module has already registered a module called %s",
|
|
|
|
full_name);
|
|
|
|
full_name);
|
|
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -1753,7 +1753,7 @@ static PyObject *sip_api_build_result(int *isErr, const char *fmt, ...)
|
|
|
|
badfmt = TRUE;
|
|
|
|
badfmt = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
if (badfmt)
|
|
|
|
if (badfmt)
|
|
|
|
PyErr_Format(PyExc_SystemError,"sipBuildResult(): invalid format string \"%s\"",fmt);
|
|
|
|
PyErr_Format(PyExc_SystemError,"sipTQtBuildResult(): invalid format string \"%s\"",fmt);
|
|
|
|
else if (tupsz < 0 || (res = PyTuple_New(tupsz)) != NULL)
|
|
|
|
else if (tupsz < 0 || (res = PyTuple_New(tupsz)) != NULL)
|
|
|
|
res = buildObject(res,fmt,va);
|
|
|
|
res = buildObject(res,fmt,va);
|
|
|
|
|
|
|
|
|
|
|
@ -2127,7 +2127,7 @@ static int sip_api_parse_result(int *isErr, PyObject *method, PyObject *res,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ch == '\0')
|
|
|
|
if (ch == '\0')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_SystemError, "sipParseResult(): invalid format string \"%s\"", fmt - 1);
|
|
|
|
PyErr_Format(PyExc_SystemError, "sipTQtParseResult(): invalid format string \"%s\"", fmt - 1);
|
|
|
|
rc = -1;
|
|
|
|
rc = -1;
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -2667,7 +2667,7 @@ static int sip_api_parse_result(int *isErr, PyObject *method, PyObject *res,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
PyErr_Format(PyExc_SystemError,"sipParseResult(): invalid format character '%c'",ch);
|
|
|
|
PyErr_Format(PyExc_SystemError,"sipTQtParseResult(): invalid format character '%c'",ch);
|
|
|
|
rc = -1;
|
|
|
|
rc = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -6589,7 +6589,7 @@ static void sip_api_bad_catcher_result(PyObject *method)
|
|
|
|
PyMethod_GET_SELF(method) == NULL)
|
|
|
|
PyMethod_GET_SELF(method) == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
"invalid argument to sipBadCatcherResult()");
|
|
|
|
"invalid argument to sipTQtBadCatcherResult()");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -6655,7 +6655,7 @@ static void sip_api_transfer_to(PyObject *self, PyObject *owner)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* There is a legitimate case where we try to transfer a PyObject that
|
|
|
|
* There is a legitimate case where we try to transfer a PyObject that
|
|
|
|
* may not be a SIP generated class. The virtual handler code calls
|
|
|
|
* may not be a SIP-TQt generated class. The virtual handler code calls
|
|
|
|
* this function to keep the C/C++ instance alive when it gets rid of
|
|
|
|
* this function to keep the C/C++ instance alive when it gets rid of
|
|
|
|
* the Python object returned by the Python method. A class may have
|
|
|
|
* the Python object returned by the Python method. A class may have
|
|
|
|
* handwritten code that converts a regular Python type - so we can't
|
|
|
|
* handwritten code that converts a regular Python type - so we can't
|
|
|
@ -8526,7 +8526,7 @@ static PyObject *sipSimpleWrapper_new(sipWrapperType *wt, PyObject *args,
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* See if it cannot be instantiated or sub-classed from Python, eg.
|
|
|
|
* See if it cannot be instantiated or sub-classed from Python, eg.
|
|
|
|
* it's an opaque class. Some restrictions might be overcome with
|
|
|
|
* it's an opaque class. Some restrictions might be overcome with
|
|
|
|
* better SIP support.
|
|
|
|
* better SIP-TQt support.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (((sipClassTypeDef *)td)->ctd_init == NULL)
|
|
|
|
if (((sipClassTypeDef *)td)->ctd_init == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -8573,12 +8573,12 @@ static int sipSimpleWrapper_init(sipSimpleWrapper *self, PyObject *args,
|
|
|
|
static int (*kw_handler)(PyObject *, void *, PyObject *);
|
|
|
|
static int (*kw_handler)(PyObject *, void *, PyObject *);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Get any keyword handler if necessary. In SIP v5 this will be
|
|
|
|
* Get any keyword handler if necessary. In SIP-TQt v5 this will be
|
|
|
|
* generalised and not PyTQt specific.
|
|
|
|
* generalised and not PyTQt specific.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (!got_kw_handler)
|
|
|
|
if (!got_kw_handler)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kw_handler = sip_api_import_symbol("pyqt_kw_handler");
|
|
|
|
kw_handler = sip_api_import_symbol("pytqt_kw_handler");
|
|
|
|
got_kw_handler = TRUE;
|
|
|
|
got_kw_handler = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -9131,7 +9131,7 @@ sipWrapperType sipSimpleWrapper_Type = {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0)
|
|
|
|
PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0)
|
|
|
|
"sip.simplewrapper", /* tp_name */
|
|
|
|
"sip_tqt.simplewrapper", /* tp_name */
|
|
|
|
sizeof (sipSimpleWrapper), /* tp_basicsize */
|
|
|
|
sizeof (sipSimpleWrapper), /* tp_basicsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
(destructor)sipSimpleWrapper_dealloc, /* tp_dealloc */
|
|
|
|
(destructor)sipSimpleWrapper_dealloc, /* tp_dealloc */
|
|
|
@ -10461,7 +10461,7 @@ static int *sip_api_unicode_as_wstring(PyObject *obj)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void raiseNoWChar()
|
|
|
|
static void raiseNoWChar()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PyErr_SetString(PyExc_SystemError, "sip built without wchar_t support");
|
|
|
|
PyErr_SetString(PyExc_SystemError, "sip-tqt built without wchar_t support");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|