summaryrefslogtreecommitdiff
path: root/Lib/python
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2020-02-13 19:28:03 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2020-02-13 19:32:13 +0000
commit67a38589a8164237df82a65dc6f592b423012f87 (patch)
tree7688f9c6e3a6ae0a3ebe295385a3658afc9abc04 /Lib/python
parente631b226ca771a7f3d08d322b9b063c9ea3e66a2 (diff)
downloadswig-67a38589a8164237df82a65dc6f592b423012f87.tar.gz
Minor code refactor in Python traits_asptr::asptr
Diffstat (limited to 'Lib/python')
-rw-r--r--Lib/python/pystdcommon.swg11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg
index 57b26d7e8..afa71350a 100644
--- a/Lib/python/pystdcommon.swg
+++ b/Lib/python/pystdcommon.swg
@@ -45,23 +45,22 @@ namespace swig {
template <class Type>
struct traits_asptr {
static int asptr(PyObject *obj, Type **val) {
+ int res = SWIG_ERROR;
+ swig_type_info *descriptor = type_info<Type>();
if (val) {
Type *p = 0;
- swig_type_info *descriptor = type_info<Type>();
int newmem = 0;
- int res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
+ res = descriptor ? SWIG_ConvertPtrAndOwn(obj, (void **)&p, descriptor, 0, &newmem) : SWIG_ERROR;
if (SWIG_IsOK(res)) {
if (newmem & SWIG_CAST_NEW_MEMORY) {
res |= SWIG_NEWOBJMASK;
}
*val = p;
}
- return res;
} else {
- swig_type_info *descriptor = type_info<Type>();
- int res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR;
- return res;
+ res = descriptor ? SWIG_ConvertPtr(obj, 0, descriptor, 0) : SWIG_ERROR;
}
+ return res;
}
};