Changeset 5743 for anuga_core/source/anuga/utilities/util_ext.h
- Timestamp:
- Sep 6, 2008, 10:34:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/util_ext.h
r5306 r5743 281 281 double get_python_double(PyObject *O, char *name) { 282 282 PyObject *TObject; 283 #define BUFFER_SIZE 80 284 char buf[BUFFER_SIZE]; 283 285 double tmp; 286 int n; 284 287 285 288 … … 287 290 TObject = PyObject_GetAttrString(O, name); 288 291 if (!TObject) { 289 PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_double could not obtain double from object"); 292 n = snprintf(buf, BUFFER_SIZE, "util_ext.h: get_python_double could not obtain double %s.\n", name); 293 //printf("name = %s",name); 294 PyErr_SetString(PyExc_RuntimeError, buf); 295 290 296 return 0.0; 291 297 } … … 298 304 } 299 305 306 307 308 300 309 int get_python_integer(PyObject *O, char *name) { 301 310 PyObject *TObject; 302 int tmp; 311 #define BUFFER_SIZE 80 312 char buf[BUFFER_SIZE]; 313 long tmp; 314 int n; 303 315 304 316 … … 306 318 TObject = PyObject_GetAttrString(O, name); 307 319 if (!TObject) { 308 PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_integer could not obtain double from object"); 320 n = snprintf(buf, BUFFER_SIZE, "util_ext.h: get_python_integer could not obtain double %s.\n", name); 321 //printf("name = %s",name); 322 PyErr_SetString(PyExc_RuntimeError, buf); 309 323 return 0; 310 324 } 311 325 312 tmp = Py Float_AsDouble(TObject);326 tmp = PyInt_AsLong(TObject); 313 327 314 328 Py_DECREF(TObject);
Note: See TracChangeset
for help on using the changeset viewer.