reduce the aliasing warnings (when compiling with CFLAGS='-O2 -Wstrict-aliasing=2') to the minimum, ie, enums and pointer to functions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8883 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
220a0ad055
commit
a2c99f619d
6 changed files with 34 additions and 23 deletions
|
|
@ -281,15 +281,17 @@ PySwigClientData_New(PyObject* obj)
|
|||
} else {
|
||||
#if (PY_VERSION_HEX < 0x02020000)
|
||||
data->newraw = 0;
|
||||
data->newargs = obj;
|
||||
Py_INCREF(obj);
|
||||
#else
|
||||
data->newraw = PyObject_GetAttrString((PyObject*)&PyBaseObject_Type, (char *)"__new__");
|
||||
Py_INCREF(data->newraw);
|
||||
data->newargs = PyTuple_New(1);
|
||||
PyTuple_SetItem(data->newargs, 0, obj);
|
||||
Py_INCREF(data->newargs);
|
||||
data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
|
||||
#endif
|
||||
if (data->newraw) {
|
||||
Py_INCREF(data->newraw);
|
||||
data->newargs = PyTuple_New(1);
|
||||
PyTuple_SetItem(data->newargs, 0, obj);
|
||||
} else {
|
||||
data->newargs = obj;
|
||||
}
|
||||
Py_INCREF(data->newargs);
|
||||
}
|
||||
/* the destroy method, aka as the C++ delete method */
|
||||
data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
|
||||
|
|
@ -534,7 +536,7 @@ PySwigObject_own(PyObject *v, PyObject *args)
|
|||
else
|
||||
{
|
||||
PySwigObject *sobj = (PySwigObject *)v;
|
||||
PyObject *obj = sobj->own ? Py_True : Py_False;
|
||||
PyObject *obj = PyBool_FromLong(sobj->own);
|
||||
if (val) {
|
||||
#ifdef METH_NOARGS
|
||||
if (PyObject_IsTrue(val)) {
|
||||
|
|
@ -550,7 +552,6 @@ PySwigObject_own(PyObject *v, PyObject *args)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
Py_INCREF(obj);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue