Changeset 0227d1 in git for Singular/pyobject.cc
- Timestamp:
- Jun 27, 2012, 12:01:18 AM (12 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/pyobject.cc
r107b5b2 r0227d1 108 108 typedef PyObject* ptr_type; 109 109 struct sequence_tag{}; 110 struct null_tag {};111 110 112 111 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 } 115 115 116 116 ptr_type check_context(ptr_type ptr) const { … … 131 131 return *this; 132 132 133 return self( null_tag());133 return self(NULL); 134 134 } 135 135 … … 150 150 case '.': case COLONCOLON: case ATTRIB_CMD: return attr(arg); 151 151 } 152 return self( null_tag());152 return self(NULL); 153 153 } 154 154 … … 162 162 return self(); 163 163 } 164 return self( null_tag());164 return self(NULL); 165 165 } 166 166 … … 228 228 } 229 229 230 void handle_exception() const { 230 BOOLEAN handle_exception() const { 231 232 if(!PyErr_Occurred()) return FALSE; 231 233 232 234 PyObject *pType, *pMessage, *pTraceback; … … 241 243 242 244 PyErr_Clear(); 245 return TRUE; 243 246 } 244 247 … … 559 562 560 563 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); 562 567 } 563 568
Note: See TracChangeset
for help on using the changeset viewer.