Ignore:
Timestamp:
Sep 6, 2008, 10:34:12 PM (16 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/util_ext.h

    r5306 r5743  
    281281double get_python_double(PyObject *O, char *name) {
    282282  PyObject *TObject;
     283  #define BUFFER_SIZE 80
     284  char buf[BUFFER_SIZE];
    283285  double tmp;
     286  int n;
    284287 
    285288
     
    287290  TObject = PyObject_GetAttrString(O, name);
    288291  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
    290296    return 0.0;
    291297  } 
     
    298304}
    299305
     306
     307
     308
    300309int get_python_integer(PyObject *O, char *name) {
    301310  PyObject *TObject;
    302   int tmp;
     311  #define BUFFER_SIZE 80
     312  char buf[BUFFER_SIZE];
     313  long tmp;
     314  int n;
    303315 
    304316
     
    306318  TObject = PyObject_GetAttrString(O, name);
    307319  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);
    309323    return 0;
    310324  } 
    311325 
    312   tmp = PyFloat_AsDouble(TObject);
     326  tmp = PyInt_AsLong(TObject);
    313327 
    314328  Py_DECREF(TObject);
Note: See TracChangeset for help on using the changeset viewer.