mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-15 17:20:07 +01:00
Merge pull request #1199 from RobinD42/sip-4.19.16
Update sip to version 4.19.16
(cherry picked from commit 7383d34fce)
This commit is contained in:
@@ -64,8 +64,9 @@ Changes in this release include the following:
|
||||
|
||||
* Fixed a crashing bug when using a member of a transient wx.VisualAttributes
|
||||
object. Also set the attributes to be read-only to simplify the fix. (#1198).
|
||||
|
||||
|
||||
* Updated sip to version 4.19.16.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
build.py
12
build.py
@@ -75,12 +75,12 @@ wxICON = 'docs/sphinx/_static/images/sphinxdocs/mondrian.png'
|
||||
|
||||
# Some tools will be downloaded for the builds. These are the versions and
|
||||
# MD5s of the tool binaries currently in use.
|
||||
sipCurrentVersion = '4.19.13'
|
||||
sipCurrentVersion = '4.19.16'
|
||||
sipMD5 = {
|
||||
'darwin' : '2d2958a6f4cceebe5e4facb0114f9b0c',
|
||||
'win32' : '83cad605ae09a42440afdf89358c7f82',
|
||||
'linux32' : 'd9d2f8d1e897d2f238a5c49532d55933',
|
||||
'linux64' : '19f59f0bceb60dfd9b41f8e63b002492',
|
||||
'darwin' : 'ddb27cd807cc5474ce4d557f18b709dc',
|
||||
'win32' : 'e381c10b799a2bd130fceb330a149626',
|
||||
'linux32' : '6f5438ecaf38eef35380ff6652747f8b',
|
||||
'linux64' : 'e8566e05d2122344ec7ce0e289877f74',
|
||||
}
|
||||
|
||||
wafCurrentVersion = '2.0.8'
|
||||
@@ -317,7 +317,7 @@ def setDevModeOptions(args):
|
||||
myDevModeOptions = [
|
||||
#'--build_dir=../bld',
|
||||
#'--prefix=/opt/wx/2.9',
|
||||
'--jobs=6', # % numCPUs(),
|
||||
'--jobs=8', # % numCPUs(),
|
||||
|
||||
# These will be ignored on the other platforms so it is okay to
|
||||
# include them unconditionally
|
||||
|
||||
@@ -2284,6 +2284,8 @@
|
||||
"LOCALE_CAT_NUMBER":"wx.",
|
||||
"LOCALE_DATE_TIME_FMT":"wx.",
|
||||
"LOCALE_DECIMAL_POINT":"wx.",
|
||||
"LOCALE_DONT_LOAD_DEFAULT":"wx.",
|
||||
"LOCALE_LOAD_DEFAULT":"wx.",
|
||||
"LOCALE_LONG_DATE_FMT":"wx.",
|
||||
"LOCALE_SHORT_DATE_FMT":"wx.",
|
||||
"LOCALE_THOUSANDS_SEP":"wx.",
|
||||
@@ -2329,6 +2331,7 @@
|
||||
"Locale":"wx.",
|
||||
"LocaleCategory":"wx.",
|
||||
"LocaleInfo":"wx.",
|
||||
"LocaleInitFlags":"wx.",
|
||||
"Log":"wx.",
|
||||
"LogBuffer":"wx.",
|
||||
"LogChain":"wx.",
|
||||
|
||||
@@ -178,8 +178,7 @@ def run():
|
||||
c.addPrivateCopyCtor()
|
||||
c.find('wxFileConfig').findOverload('wxInputStream').find('conv').ignore()
|
||||
ctor = c.find('wxFileConfig').findOverload('wxString').find('conv').ignore()
|
||||
#ctor.items.remove(ctor.find('conv'))
|
||||
ctor = c.find('Save').find('conv').ignore()
|
||||
c.find('Save').ignore()
|
||||
c.find('GetGlobalFile').ignore()
|
||||
c.find('GetLocalFile').ignore()
|
||||
|
||||
@@ -188,7 +187,13 @@ def run():
|
||||
c.find('GetFirstEntry').ignore()
|
||||
c.find('GetNextEntry').ignore()
|
||||
|
||||
|
||||
c.addCppMethod('bool', 'Save', '(wxOutputStream& os)', doc=c.find('Save').briefDoc, body="""\
|
||||
#if wxUSE_STREAMS
|
||||
return self->Save(*os);
|
||||
#else
|
||||
wxPyRaiseNotImplemented();
|
||||
#endif
|
||||
""")
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# In C++ wxConfig is a #define to some other config class. We'll let our
|
||||
|
||||
@@ -61,7 +61,6 @@ def run():
|
||||
c.find('CreateCanvas').isVirtual = True
|
||||
c.find('CreateControlBar').isVirtual = True
|
||||
c.find('Initialize').isVirtual = True
|
||||
c.find('InitializeWithModality').isVirtual = True
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,24 +43,28 @@ def run():
|
||||
c.find('GetGeneric').mustHaveApp()
|
||||
c.find('GetDefault').mustHaveApp()
|
||||
c.find('Set').mustHaveApp()
|
||||
|
||||
|
||||
#virtual void DrawTitleBarBitmap(wxWindow *win,
|
||||
# wxDC& dc,
|
||||
# const wxRect& rect,
|
||||
# wxTitleBarButton button,
|
||||
# int flags = 0) = 0;
|
||||
c.find('DrawTitleBarBitmap').setCppCode("""\
|
||||
#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
|
||||
self->DrawTitleBarBitmap(win, *dc, *rect, button, flags);
|
||||
#endif
|
||||
""")
|
||||
|
||||
c.find('DrawTitleBarBitmap').ignore()
|
||||
draw_tb_bmp_doc = c.find('DrawTitleBarBitmap').briefDoc
|
||||
|
||||
c = module.find('wxDelegateRendererNative')
|
||||
c.mustHaveApp()
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
#virtual void DrawTitleBarBitmap(wxWindow *win,
|
||||
# wxDC& dc,
|
||||
# const wxRect& rect,
|
||||
# wxTitleBarButton button,
|
||||
# int flags = 0);
|
||||
c.addCppMethod('void', 'DrawTitleBarBitmap',
|
||||
'(wxWindow* win, wxDC& dc, const wxRect& rect, wxTitleBarButton button, int flags = 0)',
|
||||
doc=draw_tb_bmp_doc,
|
||||
body="""\
|
||||
#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
|
||||
self->DrawTitleBarBitmap(win, *dc, *rect, button, flags);
|
||||
#else
|
||||
wxPyRaiseNotImplemented();
|
||||
#endif
|
||||
""")
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
@@ -70,4 +74,3 @@ def run():
|
||||
#---------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
|
||||
@@ -54,11 +54,12 @@ def run():
|
||||
|
||||
# This is intentionally not documented, but I think it would be handy to
|
||||
# use from wxPython.
|
||||
meth = MethodDef(name='GetBordersForSizer', isVirtual=True, type='void', protection='public',
|
||||
briefDoc="Returns extra space that may be needed for borders within a StaticBox.",
|
||||
items=[ParamDef(name='borderTop', type='int*', out=True),
|
||||
ParamDef(name='borderOther', type='int*', out=True),
|
||||
])
|
||||
meth = MethodDef(
|
||||
name='GetBordersForSizer', isConst=True, isVirtual=True, type='void', protection='public',
|
||||
briefDoc="Returns extra space that may be needed for borders within a StaticBox.",
|
||||
items=[ParamDef(name='borderTop', type='int*', out=True),
|
||||
ParamDef(name='borderOther', type='int*', out=True),
|
||||
])
|
||||
c.addItem(meth)
|
||||
|
||||
module.addGlobalStr('wxStaticBoxNameStr', c)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The implementation of the Python object to C/C++ integer convertors.
|
||||
*
|
||||
* Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
* Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
*
|
||||
* This file is part of SIP.
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* The legacy integer conversions (ie. without support for overflow checking)
|
||||
* are flawed and inconsistent. Large Python signed values were converted to
|
||||
* -1 whereas small values where truncated. When converting function arguments
|
||||
* -1 whereas small values were truncated. When converting function arguments
|
||||
* all overlows were ignored, however when converting the results returned by
|
||||
* Python re-implementations then large Python values raised an exception
|
||||
* whereas small values were truncated.
|
||||
@@ -202,6 +202,15 @@ unsigned sip_api_long_as_unsigned_int(PyObject *o)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert a Python object to a C size_t.
|
||||
*/
|
||||
size_t sip_api_long_as_size_t(PyObject *o)
|
||||
{
|
||||
return (size_t)long_as_unsigned_long(o, SIZE_MAX);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert a Python object to a C long.
|
||||
*/
|
||||
@@ -237,6 +246,11 @@ unsigned PY_LONG_LONG sip_api_long_as_unsigned_long_long(PyObject *o)
|
||||
{
|
||||
unsigned PY_LONG_LONG value;
|
||||
|
||||
/*
|
||||
* Note that this doesn't handle Python v2 int objects, but the old
|
||||
* convertors didn't either.
|
||||
*/
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
if (overflow_checking)
|
||||
@@ -252,10 +266,6 @@ unsigned PY_LONG_LONG sip_api_long_as_unsigned_long_long(PyObject *o)
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Note that this doesn't handle Python v2 int objects, but the old
|
||||
* convertors didn't either.
|
||||
*/
|
||||
value = PyLong_AsUnsignedLongLongMask(o);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ extern "C" {
|
||||
/*
|
||||
* Define the SIP version number.
|
||||
*/
|
||||
#define SIP_VERSION 0x04130d
|
||||
#define SIP_VERSION_STR "4.19.13"
|
||||
#define SIP_VERSION 0x041310
|
||||
#define SIP_VERSION_STR "4.19.16"
|
||||
|
||||
|
||||
/*
|
||||
@@ -68,6 +68,10 @@ extern "C" {
|
||||
*
|
||||
* History:
|
||||
*
|
||||
* 12.6 Added sip_api_long_as_size_t() to the public API.
|
||||
* Added the '=' format character to sip_api_build_result().
|
||||
* Added the '=' format character to sip_api_parse_result_ex().
|
||||
*
|
||||
* 12.5 Replaced the sipConvertFromSliceObject() macro with
|
||||
* sip_api_convert_from_slice_object() in the public API.
|
||||
*
|
||||
@@ -268,7 +272,7 @@ extern "C" {
|
||||
* 0.0 Original version.
|
||||
*/
|
||||
#define SIP_API_MAJOR_NR 12
|
||||
#define SIP_API_MINOR_NR 5
|
||||
#define SIP_API_MINOR_NR 6
|
||||
|
||||
|
||||
/*
|
||||
@@ -281,6 +285,41 @@ extern "C" {
|
||||
typedef unsigned int uint;
|
||||
|
||||
|
||||
/* Some C++ compatibility stuff. */
|
||||
#if defined(__cplusplus)
|
||||
|
||||
/*
|
||||
* Cast a PyCFunctionWithKeywords to a PyCFunction in such a way that it
|
||||
* suppresses the GCC -Wcast-function-type warning.
|
||||
*/
|
||||
#define SIP_MLMETH_CAST(m) reinterpret_cast<PyCFunction>(reinterpret_cast<void (*)(void)>(m))
|
||||
|
||||
#if __cplusplus >= 201103L || defined(_MSVC_LANG)
|
||||
|
||||
/* C++11 and later. */
|
||||
#define SIP_NULLPTR nullptr
|
||||
#define SIP_OVERRIDE override
|
||||
|
||||
#else
|
||||
|
||||
/* Earlier versions of C++. */
|
||||
#define SIP_NULLPTR 0
|
||||
#define SIP_OVERRIDE
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* Cast a PyCFunctionWithKeywords to a PyCFunction. */
|
||||
#define SIP_MLMETH_CAST(m) ((PyCFunction)(m))
|
||||
|
||||
/* C. */
|
||||
#define SIP_NULLPTR NULL
|
||||
#define SIP_OVERRIDE
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Some Python compatibility stuff. */
|
||||
#if PY_VERSION_HEX >= 0x02050000
|
||||
|
||||
@@ -1899,6 +1938,7 @@ typedef struct _sipAPIDef {
|
||||
int (*api_convert_from_slice_object)(PyObject *slice, SIP_SSIZE_T length,
|
||||
SIP_SSIZE_T *start, SIP_SSIZE_T *stop, SIP_SSIZE_T *step,
|
||||
SIP_SSIZE_T *slicelength);
|
||||
size_t (*api_long_as_size_t)(PyObject *o);
|
||||
} sipAPIDef;
|
||||
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ unsigned long sip_api_long_as_unsigned_long(PyObject *o);
|
||||
PY_LONG_LONG sip_api_long_as_long_long(PyObject *o);
|
||||
unsigned PY_LONG_LONG sip_api_long_as_unsigned_long_long(PyObject *o);
|
||||
#endif
|
||||
size_t sip_api_long_as_size_t(PyObject *o);
|
||||
|
||||
|
||||
extern sipQtAPI *sipQtSupport; /* The Qt support API. */
|
||||
|
||||
@@ -647,6 +647,7 @@ static const sipAPIDef sip_api = {
|
||||
* The following are part of the public API.
|
||||
*/
|
||||
sip_api_convert_from_slice_object,
|
||||
sip_api_long_as_size_t,
|
||||
};
|
||||
|
||||
|
||||
@@ -692,6 +693,8 @@ typedef struct _sipParseFailure {
|
||||
PyObject *detail_obj; /* The detail if a Python object. */
|
||||
int arg_nr; /* The wrong positional argument. */
|
||||
const char *arg_name; /* The wrong keyword argument. */
|
||||
int overflow_arg_nr; /* The overflowed positional argument. */
|
||||
const char *overflow_arg_name; /* The overflowed keyword argument. */
|
||||
} sipParseFailure;
|
||||
|
||||
|
||||
@@ -883,6 +886,8 @@ static int getSelfFromArgs(sipTypeDef *td, PyObject *args, int argnr,
|
||||
sipSimpleWrapper **selfp);
|
||||
static int compareTypedefName(const void *key, const void *el);
|
||||
static int checkPointer(void *ptr, sipSimpleWrapper *sw);
|
||||
static void *cast_cpp_ptr(void *ptr, PyTypeObject *src_type,
|
||||
const sipTypeDef *dst_type);
|
||||
static void finalise(void);
|
||||
static PyObject *getDefaultBase(void);
|
||||
static PyObject *getDefaultSimpleBase(void);
|
||||
@@ -933,7 +938,7 @@ static int addLicense(PyObject *dict, sipLicenseDef *lc);
|
||||
static PyObject *assign(PyObject *self, PyObject *args);
|
||||
static PyObject *cast(PyObject *self, PyObject *args);
|
||||
static PyObject *callDtor(PyObject *self, PyObject *args);
|
||||
static PyObject *dumpWrapper(PyObject *self, PyObject *args);
|
||||
static PyObject *dumpWrapper(PyObject *self, PyObject *arg);
|
||||
static PyObject *enableAutoconversion(PyObject *self, PyObject *args);
|
||||
static PyObject *isDeleted(PyObject *self, PyObject *args);
|
||||
static PyObject *isPyCreated(PyObject *self, PyObject *args);
|
||||
@@ -948,6 +953,7 @@ static PyObject *setDestroyOnExit(PyObject *self, PyObject *args);
|
||||
static void print_object(const char *label, PyObject *obj);
|
||||
static void addToParent(sipWrapper *self, sipWrapper *owner);
|
||||
static void removeFromParent(sipWrapper *self);
|
||||
static void detachChildren(sipWrapper *self);
|
||||
static void release(void *addr, const sipTypeDef *td, int state);
|
||||
static void callPyDtor(sipSimpleWrapper *self);
|
||||
static int parseBytes_AsCharArray(PyObject *obj, const char **ap,
|
||||
@@ -1060,7 +1066,7 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void)
|
||||
{"assign", assign, METH_VARARGS, NULL},
|
||||
{"cast", cast, METH_VARARGS, NULL},
|
||||
{"delete", callDtor, METH_VARARGS, NULL},
|
||||
{"dump", dumpWrapper, METH_VARARGS, NULL},
|
||||
{"dump", dumpWrapper, METH_O, NULL},
|
||||
{"enableautoconversion", enableAutoconversion, METH_VARARGS, NULL},
|
||||
{"enableoverflowchecking", sipEnableOverflowChecking, METH_VARARGS, NULL},
|
||||
{"getapi", sipGetAPI, METH_VARARGS, NULL},
|
||||
@@ -1322,43 +1328,49 @@ static PyObject *setTraceMask(PyObject *self, PyObject *args)
|
||||
|
||||
|
||||
/*
|
||||
* Dump various bits of potentially useful information to stdout.
|
||||
* Dump various bits of potentially useful information to stdout. Note that we
|
||||
* use the same calling convention as sys.getrefcount() so that it has the
|
||||
* same caveat regarding the reference count.
|
||||
*/
|
||||
static PyObject *dumpWrapper(PyObject *self, PyObject *args)
|
||||
static PyObject *dumpWrapper(PyObject *self, PyObject *arg)
|
||||
{
|
||||
sipSimpleWrapper *sw;
|
||||
|
||||
(void)self;
|
||||
|
||||
if (PyArg_ParseTuple(args, "O!:dump", &sipSimpleWrapper_Type, &sw))
|
||||
if (!PyObject_TypeCheck(arg, (PyTypeObject *)&sipSimpleWrapper_Type))
|
||||
{
|
||||
print_object(NULL, (PyObject *)sw);
|
||||
|
||||
#if PY_VERSION_HEX >= 0x02050000
|
||||
printf(" Reference count: %" PY_FORMAT_SIZE_T "d\n", Py_REFCNT(sw));
|
||||
#else
|
||||
printf(" Reference count: %d\n", Py_REFCNT(sw));
|
||||
#endif
|
||||
printf(" Address of wrapped object: %p\n", sip_api_get_address(sw));
|
||||
printf(" Created by: %s\n", (sipIsDerived(sw) ? "Python" : "C/C++"));
|
||||
printf(" To be destroyed by: %s\n", (sipIsPyOwned(sw) ? "Python" : "C/C++"));
|
||||
|
||||
if (PyObject_TypeCheck((PyObject *)sw, (PyTypeObject *)&sipWrapper_Type))
|
||||
{
|
||||
sipWrapper *w = (sipWrapper *)sw;
|
||||
|
||||
print_object("Parent wrapper", (PyObject *)w->parent);
|
||||
print_object("Next sibling wrapper", (PyObject *)w->sibling_next);
|
||||
print_object("Previous sibling wrapper",
|
||||
(PyObject *)w->sibling_prev);
|
||||
print_object("First child wrapper", (PyObject *)w->first_child);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"dump() argument 1 must be sip.simplewrapper, not %s",
|
||||
Py_TYPE(arg)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
sw = (sipSimpleWrapper *)arg;
|
||||
|
||||
print_object(NULL, (PyObject *)sw);
|
||||
|
||||
#if PY_VERSION_HEX >= 0x02050000
|
||||
printf(" Reference count: %" PY_FORMAT_SIZE_T "d\n", Py_REFCNT(sw));
|
||||
#else
|
||||
printf(" Reference count: %d\n", Py_REFCNT(sw));
|
||||
#endif
|
||||
printf(" Address of wrapped object: %p\n", sip_api_get_address(sw));
|
||||
printf(" Created by: %s\n", (sipIsDerived(sw) ? "Python" : "C/C++"));
|
||||
printf(" To be destroyed by: %s\n", (sipIsPyOwned(sw) ? "Python" : "C/C++"));
|
||||
|
||||
if (PyObject_TypeCheck((PyObject *)sw, (PyTypeObject *)&sipWrapper_Type))
|
||||
{
|
||||
sipWrapper *w = (sipWrapper *)sw;
|
||||
|
||||
print_object("Parent wrapper", (PyObject *)w->parent);
|
||||
print_object("Next sibling wrapper", (PyObject *)w->sibling_next);
|
||||
print_object("Previous sibling wrapper", (PyObject *)w->sibling_prev);
|
||||
print_object("First child wrapper", (PyObject *)w->first_child);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
@@ -2650,6 +2662,10 @@ static PyObject *buildObject(PyObject *obj, const char *fmt, va_list va)
|
||||
el = PyLong_FromUnsignedLong(va_arg(va, unsigned));
|
||||
break;
|
||||
|
||||
case '=':
|
||||
el = PyLong_FromUnsignedLong(va_arg(va, size_t));
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
{
|
||||
/* This is deprecated. */
|
||||
@@ -3158,6 +3174,19 @@ static int parseResult(PyObject *method, PyObject *res,
|
||||
|
||||
break;
|
||||
|
||||
case '=':
|
||||
{
|
||||
size_t *p = va_arg(va, size_t *);
|
||||
size_t v = sip_api_long_as_size_t(arg);
|
||||
|
||||
if (PyErr_Occurred())
|
||||
invalid = TRUE;
|
||||
else if (p != NULL)
|
||||
*p = v;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
{
|
||||
long *p = va_arg(va, long *);
|
||||
@@ -3270,14 +3299,9 @@ static int parseResult(PyObject *method, PyObject *res,
|
||||
const char **p = va_arg(va, const char **);
|
||||
|
||||
if (parseBytes_AsString(arg, p) < 0)
|
||||
{
|
||||
invalid = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Py_INCREF(arg);
|
||||
sip_api_keep_reference((PyObject *)py_self, key, arg);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -4980,6 +5004,25 @@ static int parsePass1(PyObject **parseErrp, sipSimpleWrapper **selfp,
|
||||
break;
|
||||
}
|
||||
|
||||
case '=':
|
||||
{
|
||||
/* size_t integer. */
|
||||
|
||||
size_t *p = va_arg(va, size_t *);
|
||||
|
||||
if (arg != NULL)
|
||||
{
|
||||
size_t v = sip_api_long_as_size_t(arg);
|
||||
|
||||
if (PyErr_Occurred())
|
||||
handle_failed_int_conversion(&failure, arg);
|
||||
else
|
||||
*p = v;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'L':
|
||||
{
|
||||
/* Signed char. */
|
||||
@@ -5405,24 +5448,24 @@ static int parsePass1(PyObject **parseErrp, sipSimpleWrapper **selfp,
|
||||
exc_str = "invalid exception text";
|
||||
#endif
|
||||
|
||||
if (failure.arg_nr >= 0)
|
||||
if (failure.overflow_arg_nr >= 0)
|
||||
{
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyErr_Format(PyExc_OverflowError, "argument %d overflowed: %S",
|
||||
failure.arg_nr, failure.detail_obj);
|
||||
failure.overflow_arg_nr, failure.detail_obj);
|
||||
#else
|
||||
PyErr_Format(PyExc_OverflowError, "argument %d overflowed: %s",
|
||||
failure.arg_nr, exc_str);
|
||||
failure.overflow_arg_nr, exc_str);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyErr_Format(PyExc_OverflowError, "argument '%s' overflowed: %S",
|
||||
failure.arg_name, failure.detail_obj);
|
||||
failure.overflow_arg_name, failure.detail_obj);
|
||||
#else
|
||||
PyErr_Format(PyExc_OverflowError, "argument '%s' overflowed: %s",
|
||||
failure.arg_name, exc_str);
|
||||
failure.overflow_arg_name, exc_str);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5471,6 +5514,8 @@ static void handle_failed_int_conversion(sipParseFailure *pf, PyObject *arg)
|
||||
Py_XDECREF(pf->detail_obj);
|
||||
|
||||
pf->reason = Overflow;
|
||||
pf->overflow_arg_nr = pf->arg_nr;
|
||||
pf->overflow_arg_name = pf->arg_name;
|
||||
pf->detail_obj = xvalue;
|
||||
Py_INCREF(xvalue);
|
||||
}
|
||||
@@ -5481,9 +5526,7 @@ static void handle_failed_int_conversion(sipParseFailure *pf, PyObject *arg)
|
||||
Py_INCREF(arg);
|
||||
}
|
||||
|
||||
Py_XDECREF(xtype);
|
||||
Py_XDECREF(xvalue);
|
||||
Py_XDECREF(xtb);
|
||||
PyErr_Restore(xtype, xvalue, xtb);
|
||||
}
|
||||
|
||||
|
||||
@@ -6204,6 +6247,16 @@ static void removeFromParent(sipWrapper *self)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Detach and children of a parent.
|
||||
*/
|
||||
static void detachChildren(sipWrapper *self)
|
||||
{
|
||||
while (self->first_child != NULL)
|
||||
removeFromParent(self->first_child);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert a sequence index. Return the index or a negative value if there was
|
||||
* an error.
|
||||
@@ -6979,7 +7032,7 @@ static PyObject *createScopedEnum(sipExportedModuleDef *client,
|
||||
/* Get the enum type if we haven't done so already. */
|
||||
if (enum_type == NULL)
|
||||
{
|
||||
if ((enum_type = import_module_attr("enum", "Enum")) == NULL)
|
||||
if ((enum_type = import_module_attr("enum", "IntEnum")) == NULL)
|
||||
goto ret_err;
|
||||
}
|
||||
|
||||
@@ -8228,7 +8281,9 @@ static void sip_api_transfer_back(PyObject *self)
|
||||
Py_DECREF(sw);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromParent((sipWrapper *)sw);
|
||||
}
|
||||
|
||||
sipSetPyOwned(sw);
|
||||
}
|
||||
@@ -8251,7 +8306,9 @@ static void sip_api_transfer_break(PyObject *self)
|
||||
Py_DECREF(sw);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromParent((sipWrapper *)sw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9140,17 +9197,9 @@ void *sip_api_get_cpp_ptr(sipSimpleWrapper *sw, const sipTypeDef *td)
|
||||
if (td != NULL)
|
||||
{
|
||||
if (PyObject_TypeCheck((PyObject *)sw, sipTypeAsPyTypeObject(td)))
|
||||
{
|
||||
sipCastFunc cast = ((const sipClassTypeDef *)((sipWrapperType *)Py_TYPE(sw))->wt_td)->ctd_cast;
|
||||
|
||||
/* Handle any multiple inheritance. */
|
||||
if (cast != NULL)
|
||||
ptr = (*cast)(ptr, td);
|
||||
}
|
||||
ptr = cast_cpp_ptr(ptr, Py_TYPE(sw), td);
|
||||
else
|
||||
{
|
||||
ptr = NULL;
|
||||
}
|
||||
|
||||
if (ptr == NULL)
|
||||
PyErr_Format(PyExc_TypeError, "could not convert '%s' to '%s'",
|
||||
@@ -9162,6 +9211,22 @@ void *sip_api_get_cpp_ptr(sipSimpleWrapper *sw, const sipTypeDef *td)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Cast a C/C++ pointer from a source type to a destination type.
|
||||
*/
|
||||
static void *cast_cpp_ptr(void *ptr, PyTypeObject *src_type,
|
||||
const sipTypeDef *dst_type)
|
||||
{
|
||||
sipCastFunc cast = ((const sipClassTypeDef *)((sipWrapperType *)src_type)->wt_td)->ctd_cast;
|
||||
|
||||
/* C structures and base classes don't have cast functions. */
|
||||
if (cast != NULL)
|
||||
ptr = (*cast)(ptr, dst_type);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check that a pointer is non-NULL.
|
||||
*/
|
||||
@@ -9844,7 +9909,7 @@ static int convertPass(const sipTypeDef **tdp, void **cppPtr)
|
||||
|
||||
while (scc->scc_convertor != NULL)
|
||||
{
|
||||
PyTypeObject *base_type, *tp;
|
||||
PyTypeObject *base_type = sipTypeAsPyTypeObject(scc->scc_basetype);
|
||||
|
||||
/*
|
||||
* The base type is the "root" class that may have a number of
|
||||
@@ -9853,22 +9918,15 @@ static int convertPass(const sipTypeDef **tdp, void **cppPtr)
|
||||
* provides the RTTI used by the convertors and is re-implemented
|
||||
* by derived classes. We therefore see if the target type is a
|
||||
* sub-class of the root, ie. see if the convertor might be able to
|
||||
* convert the target type to something more specific. Note that
|
||||
* we only consider direct sub-classes so that (for example) a
|
||||
* QLayout is only handled by the QObject convertor and not by the
|
||||
* QLayoutItem convertor.
|
||||
* convert the target type to something more specific.
|
||||
*/
|
||||
base_type = sipTypeAsPyTypeObject(scc->scc_basetype);
|
||||
|
||||
for (tp = py_type; tp != NULL; tp = tp->tp_base)
|
||||
if (tp == base_type)
|
||||
break;
|
||||
|
||||
if (tp != NULL)
|
||||
if (PyType_IsSubtype(py_type, base_type))
|
||||
{
|
||||
void *ptr = *cppPtr;
|
||||
void *ptr;
|
||||
const sipTypeDef *sub_td;
|
||||
|
||||
ptr = cast_cpp_ptr(*cppPtr, py_type, scc->scc_basetype);
|
||||
|
||||
if ((sub_td = (*scc->scc_convertor)(&ptr)) != NULL)
|
||||
{
|
||||
PyTypeObject *sub_type = sipTypeAsPyTypeObject(sub_td);
|
||||
@@ -11626,9 +11684,8 @@ static int sipWrapper_clear(sipWrapper *self)
|
||||
}
|
||||
}
|
||||
|
||||
/* Detach children (which will be owned by C/C++). */
|
||||
while ((sw = (sipSimpleWrapper *)self->first_child) != NULL)
|
||||
removeFromParent(self->first_child);
|
||||
/* Detach any children (which will be owned by C/C++). */
|
||||
detachChildren(self);
|
||||
|
||||
return vret;
|
||||
}
|
||||
|
||||
@@ -13,35 +13,6 @@
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
// size_t will either be equivalent to an unsigned long, or to an
|
||||
// unsigned long long. wxWidgets' configure script has already figured out
|
||||
// which it is, so we can make it conditional on those results.
|
||||
|
||||
%MappedType size_t {
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <wxPython/wxpy_api.h>
|
||||
%End
|
||||
|
||||
%ConvertToTypeCode
|
||||
// Allow conversions from any number type
|
||||
if (!sipIsErr) {
|
||||
if (PyNumber_Check(sipPy))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Do the conversion
|
||||
*sipCppPtr = new size_t(wxPyInt_AsSize_t(sipPy));
|
||||
return sipGetState(sipTransferObj);
|
||||
%End
|
||||
|
||||
%ConvertFromTypeCode
|
||||
return wxPyInt_FromSize_t(*sipCpp);
|
||||
%End
|
||||
};
|
||||
|
||||
|
||||
// This type is a signed integer value that is large enough to hold a
|
||||
// pointer. Again we'll use the results of wxWidgets configuration.
|
||||
%MappedType wxIntPtr {
|
||||
|
||||
Reference in New Issue
Block a user