Mercurial > hg > vampy-host
comparison native/PyRealTime.cpp @ 113:1c7c4bd74363
Fix RealTime compare (& thus the tests, for Py2 anyway)
author | Chris Cannam |
---|---|
date | Wed, 17 Jun 2015 12:43:01 +0100 |
parents | 9343eee50605 |
children | 3489986a044c 2370b942cd32 |
comparison
equal
deleted
inserted
replaced
112:9343eee50605 | 113:1c7c4bd74363 |
---|---|
232 if (!PyRealTime_Check(self) || !PyRealTime_Check(other)) { | 232 if (!PyRealTime_Check(self) || !PyRealTime_Check(other)) { |
233 PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); | 233 PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); |
234 return Py_False; | 234 return Py_False; |
235 } | 235 } |
236 | 236 |
237 RealTime *a = PyRealTime_AS_REALTIME(self); | 237 RealTime *ap = PyRealTime_AS_REALTIME(self); |
238 RealTime *b = PyRealTime_AS_REALTIME(other); | 238 RealTime *bp = PyRealTime_AS_REALTIME(other); |
239 | |
240 if (!ap || !bp) return Py_False; | |
241 const RealTime &a = *ap; | |
242 const RealTime &b = *bp; | |
239 | 243 |
240 if (op == Py_LT) { | 244 if (op == Py_LT) { |
241 return (a < b) ? Py_True : Py_False; | 245 return (a < b) ? Py_True : Py_False; |
242 } else if (op == Py_LE) { | 246 } else if (op == Py_LE) { |
243 return (a <= b) ? Py_True : Py_False; | 247 return (a <= b) ? Py_True : Py_False; |
393 RealTimeObject *s = (RealTimeObject*) self; | 397 RealTimeObject *s = (RealTimeObject*) self; |
394 | 398 |
395 if (!PyRealTime_Check(s)) { | 399 if (!PyRealTime_Check(s)) { |
396 PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); | 400 PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); |
397 cerr << "in call PyRealTime_AsPointer(): RealTime Object Expected. " << endl; | 401 cerr << "in call PyRealTime_AsPointer(): RealTime Object Expected. " << endl; |
398 return NULL; } | 402 return NULL; |
403 } | |
399 return s->rt; | 404 return s->rt; |
400 }; | 405 }; |
401 | 406 |