Changeset 0227d1 in git


Ignore:
Timestamp:
Jun 27, 2012, 12:01:18 AM (11 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
Children:
5ebd4bcf7ead1b205b12afeec0793f8bc29e16ec
Parents:
107b5b2cfe97c55cbe5e7bd558048a83c3b62705
git-author:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-06-27 00:01:18+02:00
git-committer:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-08-01 23:15:47+02:00
Message:
fix: pyobject's ternary operation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/pyobject.cc

    r107b5b2 r0227d1  
    108108  typedef PyObject* ptr_type;
    109109  struct sequence_tag{};
    110   struct null_tag {};
    111110
    112111  PythonObject(): m_ptr(Py_None) { }
    113   PythonObject(null_tag): m_ptr(NULL) { }
    114   PythonObject(ptr_type ptr): m_ptr(ptr) {if (!ptr) handle_exception();}
     112  PythonObject(ptr_type ptr): m_ptr(ptr) {
     113    if (!ptr && handle_exception()) m_ptr = Py_None;
     114  }
    115115
    116116  ptr_type check_context(ptr_type ptr) const {
     
    131131      return *this;
    132132
    133     return self(null_tag());
     133    return self(NULL);
    134134  }
    135135
     
    150150      case '.': case COLONCOLON: case ATTRIB_CMD: return attr(arg);
    151151    }
    152     return self(null_tag());
     152    return self(NULL);
    153153  }
    154154
     
    162162        return self();
    163163    }
    164     return self(null_tag());
     164    return self(NULL);
    165165  }
    166166
     
    228228  }
    229229
    230   void handle_exception() const {
     230  BOOLEAN handle_exception() const {
     231
     232    if(!PyErr_Occurred()) return FALSE;
    231233   
    232234    PyObject *pType, *pMessage, *pTraceback;
     
    241243   
    242244    PyErr_Clear();
     245    return TRUE;
    243246  }
    244247
     
    559562
    560563  if (!lhs(op, rhs1, rhs2).assign_to(res))
    561     return blackboxDefaultOp3(op, res, arg1, arg2, arg3);
     564    return FALSE;
     565
     566  return blackboxDefaultOp3(op, res, arg1, arg2, arg3);
    562567}
    563568
Note: See TracChangeset for help on using the changeset viewer.