archpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
{
static const char *keywords[] = { "size", "signed", NULL };
- int size, is_signed = 1;
+ int size;
+ PyObject *is_signed_obj = nullptr;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "i|p", keywords,
- &size, &is_signed))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "i|O", keywords,
+ &size, &is_signed_obj))
return nullptr;
+ /* Assume signed by default. */
+ bool is_signed = (is_signed_obj == nullptr
+ || PyObject_IsTrue (is_signed_obj));
+
struct gdbarch *gdbarch;
ARCHPY_REQUIRE_VALID (self, gdbarch);
}
foreach size {0 1 2 3 4 8 16} {
- foreach sign {"" ", True" ", False"} {
+ foreach sign {"" ", True" ", False" ", None" ", \"blah\""} {
set fullsize [expr 8 * $size]
gdb_test_no_output "python t = arch.integer_type($fullsize$sign)" \
"get integer type for $size$sign"