diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/python.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 4875ffd2..67f362b 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1350,19 +1350,17 @@ gdbpy_print_stack_or_quit () static PyObject * gdbpy_progspaces (PyObject *unused1, PyObject *unused2) { - struct program_space *ps; - gdbpy_ref<> list (PyList_New (0)); if (list == NULL) return NULL; - ALL_PSPACES (ps) - { - gdbpy_ref<> item = pspace_to_pspace_object (ps); + for (struct program_space *ps : program_spaces) + { + gdbpy_ref<> item = pspace_to_pspace_object (ps); - if (item == NULL || PyList_Append (list.get (), item.get ()) == -1) - return NULL; - } + if (item == NULL || PyList_Append (list.get (), item.get ()) == -1) + return NULL; + } return list.release (); } |