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