This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] [commit] Fix crashes on missing`lib*/pythonX.Y/encodings/'
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: archer at sourceware dot org
- Date: Wed, 4 Mar 2009 16:01:46 +0100
- Subject: [python] [commit] Fix crashes on missing`lib*/pythonX.Y/encodings/'
commit b2d8ee40deb869373afc86c870c85aa720870072
Due to bugs in rpm wrt arch-specific dependencies one can get python-libs
without python rpm installed. Thus `/usr/lib64/python2.5/encodings' may be
missing.
gdb/
Fix python crashes on missing `lib*/pythonX.Y/encodings/'.
* python/python-frame.c (frapy_read_var): Return on NULL VAR_NAME.
* python/python-value.c (valpy_binop): Use `break' to exit from the
TRY_CATCH block. Do not call value_to_value_object on NULL RES_VAL.
---
gdb/python/python-frame.c | 2 ++
gdb/python/python-value.c | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index c98dc39..c257ac3 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -418,6 +418,8 @@ frapy_read_var (PyObject *self, PyObject *args)
volatile struct gdb_exception except;
var_name = python_string_to_target_string (sym_obj);
+ if (!var_name)
+ return NULL;
cleanup = make_cleanup (xfree, var_name);
TRY_CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index de54b9d..2507fcd 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -349,11 +349,11 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
a gdb.Value object and need to convert it from python as well. */
arg1 = convert_value_from_python (self);
if (arg1 == NULL)
- return NULL;
+ break;
arg2 = convert_value_from_python (other);
if (arg2 == NULL)
- return NULL;
+ break;
switch (opcode)
{
@@ -430,7 +430,7 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
}
GDB_PY_HANDLE_EXCEPTION (except);
- return value_to_value_object (res_val);
+ return res_val ? value_to_value_object (res_val) : NULL;
}
static PyObject *
--
1.6.0.6