avoid to write the pointer on failure
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7813 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c772c0b7f3
commit
02b14340c0
1 changed files with 6 additions and 4 deletions
|
|
@ -15,15 +15,17 @@
|
|||
swig::PyObject_var second = PySequence_GetItem(obj,1);
|
||||
T *pfirst = 0;
|
||||
U *psecond = 0;
|
||||
value_type *vp = 0;
|
||||
if (val) {
|
||||
*val = %new_instance(std::pair<T,U>);
|
||||
pfirst = &((*val)->first);
|
||||
psecond = &((*val)->second);
|
||||
vp = %new_instance(std::pair<T,U>);
|
||||
pfirst = &(vp->first);
|
||||
psecond = &(vp->second);
|
||||
}
|
||||
if ((swig::asval(first,pfirst) == SWIG_OK) && (swig::asval(second,psecond) == SWIG_OK)) {
|
||||
if (val) *val = vp;
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
%delete(*val);
|
||||
%delete(vp);
|
||||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue