Ignore:
Timestamp:
Sep 6, 2008, 4:30:16 PM (15 years ago)
Author:
steve
Message:

Found error in get_python_double

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anuga_1d/util_ext.h

    r5563 r5742  
    279279}
    280280
     281
     282
    281283double get_python_double(PyObject *O, char *name) {
    282284  PyObject *TObject;
     285  #define BUFFER_SIZE 80
     286  char buf[BUFFER_SIZE];
    283287  double tmp;
     288  int n;
    284289 
    285290
     
    287292  TObject = PyObject_GetAttrString(O, name);
    288293  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
    290298    return 0.0;
    291299  } 
     
    298306}
    299307
     308
     309
     310
    300311int get_python_integer(PyObject *O, char *name) {
    301312  PyObject *TObject;
    302   int tmp;
     313  #define BUFFER_SIZE 80
     314  char buf[BUFFER_SIZE];
     315  long tmp;
     316  int n;
    303317 
    304318
     
    306320  TObject = PyObject_GetAttrString(O, name);
    307321  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);
    309325    return 0;
    310326  } 
    311327 
    312   tmp = PyFloat_AsDouble(TObject);
     328  tmp = PyInt_AsLong(TObject);
    313329 
    314330  Py_DECREF(TObject);
Note: See TracChangeset for help on using the changeset viewer.