/* Python interface to types.
- Copyright (C) 2008-2019 Free Software Foundation, Inc.
+ Copyright (C) 2008-2020 Free Software Foundation, Inc.
This file is part of GDB.
#include "demangle.h"
#include "objfiles.h"
#include "language.h"
-#include "gdbsupport/vec.h"
#include "typeprint.h"
typedef struct pyty_type_object
else if (startswith (type_name, "enum "))
type = lookup_enum (type_name + 5, NULL);
else
- type = lookup_typename (python_language, python_gdbarch,
+ type = lookup_typename (python_language,
type_name, block, 0);
}
catch (const gdb_exception &except)
typy_iterator_object *iter_obj = (typy_iterator_object *) obj;
Py_DECREF (iter_obj->source);
+ Py_TYPE (obj)->tp_free (obj);
}
/* Create a new Type referring to TYPE. */
{
type_object *type_obj;
+ try
+ {
+ /* Try not to let stub types leak out to Python. */
+ if (TYPE_STUB (type))
+ type = check_typedef (type);
+ }
+ catch (...)
+ {
+ /* Just ignore failures in check_typedef. */
+ }
+
type_obj = PyObject_New (type_object, &type_object_type);
if (type_obj)
set_type (type_obj, type);