aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-26 09:21:14 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-26 09:21:14 -0300
commit517d1c914879bcf243442aac4b393e8ee3c26ff9 (patch)
tree6bcd1d384addc06a2e19d104a18fb15341eb2a2e /libshiboken
parentffbb8bb1df621ab3f31f859e62d21e06f9ed8a80 (diff)
Renamed Shiboken's function cppObjectIsValid to cppObjectIsInvalid.
CppGenerator::writeInvalidCppObjectCheck receives the name of the PyObject to be checked and do not set the exception message anymore, since it is done by Shiboken::cppObjectIsInvalid.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp10
-rw-r--r--libshiboken/basewrapper.h11
2 files changed, 13 insertions, 8 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index b0bb3d735..5aa042cb0 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -62,6 +62,15 @@ PyBaseWrapper_New(PyTypeObject* instanceType, ShiboTypeObject* baseWrapperType,
return self;
}
+bool
+cppObjectIsInvalid(PyObject* wrapper)
+{
+ if (((Shiboken::PyBaseWrapper*)wrapper)->validCppObject)
+ return false;
+ PyErr_SetString(PyExc_RuntimeError, "internal C++ object already deleted.");
+ return true;
+}
+
void
PyBaseWrapper_Dealloc_PrivateDtor(PyObject* self)
{
@@ -70,3 +79,4 @@ PyBaseWrapper_Dealloc_PrivateDtor(PyObject* self)
}
} // namespace Shiboken
+
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index a98b77e39..f891adb2b 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -128,14 +128,8 @@ LIBSHIBOKEN_API PyAPI_FUNC(PyObject*)
PyBaseWrapper_New(PyTypeObject* instanceType, ShiboTypeObject* baseWrapperType,
const void *cptr, unsigned int hasOwnership = 1);
-inline bool
-cppObjectIsValid(PyBaseWrapper* self)
-{
- if (self->validCppObject)
- return true;
- PyErr_SetString(PyExc_RuntimeError, "internal C++ object already deleted.");
- return false;
-}
+/// Returns true and sets a Python RuntimeError if the Python wrapper is not marked as valid.
+LIBSHIBOKEN_API bool cppObjectIsInvalid(PyObject* wrapper);
template <typename T>
void PyBaseWrapper_Dealloc(PyObject* self)
@@ -151,3 +145,4 @@ LIBSHIBOKEN_API PyAPI_FUNC(void) PyBaseWrapper_Dealloc_PrivateDtor(PyObject* sel
} // namespace Shiboken
#endif // BASEWRAPPER_H
+