* python/py-value.c (valpy_get_dynamic_type): Simplify
authorTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:38:47 +0000 (20:38 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:38:47 +0000 (20:38 +0000)
dynamic_type assignment.  Use Py_XINCREF.

gdb/ChangeLog
gdb/python/py-value.c

index fde010c5fa3ec317a0882d11d51a1eb9a48eed45..99fc791cf004c5107310adab75833b19b35d96ae 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-20  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-value.c (valpy_get_dynamic_type): Simplify
+       dynamic_type assignment.  Use Py_XINCREF.
+
 2013-05-20  Tom Tromey  <tromey@redhat.com>
 
        * python/py-type.c (typy_fields): Unconditionally decref 'r'.
index 9c55fe1f1e52cb9b0fc43cab2352b9cac435c6b5..0b2a38fa40498111a17570d1554862a0c73d7919 100644 (file)
@@ -334,18 +334,11 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
   GDB_PY_HANDLE_EXCEPTION (except);
 
   if (type == NULL)
-    {
-      /* Ensure that the TYPE field is ready.  */
-      if (!valpy_get_type (self, NULL))
-       return NULL;
-      /* We don't need to incref here, because valpy_get_type already
-        did it for us.  */
-      obj->dynamic_type = obj->type;
-    }
+    obj->dynamic_type = valpy_get_type (self, NULL);
   else
     obj->dynamic_type = type_to_type_object (type);
 
-  Py_INCREF (obj->dynamic_type);
+  Py_XINCREF (obj->dynamic_type);
   return obj->dynamic_type;
 }