C++ify xmethod_worker, get rid of VEC(xmethod_worker_ptr)
[deliverable/binutils-gdb.git] / gdb / python / py-value.c
index 16c765094a090c37464f96242ba10bf70cd6b17d..1673fa41b02891d2256a03552e6c0cd85f6e52f1 100644 (file)
@@ -1,6 +1,6 @@
 /* Python interface to values.
 
-   Copyright (C) 2008-2017 Free Software Foundation, Inc.
+   Copyright (C) 2008-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -874,7 +874,6 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
   struct value *function = ((value_object *) self)->value;
   struct value **vargs = NULL;
   struct type *ftype = NULL;
-  struct value *mark = value_mark ();
   PyObject *result = NULL;
 
   TRY
@@ -1560,10 +1559,10 @@ valpy_float (PyObject *self)
     {
       type = check_typedef (type);
 
-      if (TYPE_CODE (type) != TYPE_CODE_FLT)
+      if (TYPE_CODE (type) != TYPE_CODE_FLT || !is_floating_value (value))
        error (_("Cannot convert value to float."));
 
-      d = value_as_double (value);
+      d = target_float_to_host_double (value_contents (value), type);
     }
   CATCH (except, RETURN_MASK_ALL)
     {
@@ -1681,7 +1680,11 @@ convert_value_from_python (PyObject *obj)
          double d = PyFloat_AsDouble (obj);
 
          if (! PyErr_Occurred ())
-           value = value_from_double (builtin_type_pyfloat, d);
+           {
+             value = allocate_value (builtin_type_pyfloat);
+             target_float_from_host_double (value_contents_raw (value),
+                                            value_type (value), d);
+           }
        }
       else if (gdbpy_is_string (obj))
        {
This page took 0.024485 seconds and 4 git commands to generate.