public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [python] [commit] Fix crashes on missing `lib*/pythonX.Y/encodings/'
@ 2009-03-04 15:02 Jan Kratochvil
  0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2009-03-04 15:02 UTC (permalink / raw)
  To: archer

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-04 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04 15:02 [python] [commit] Fix crashes on missing `lib*/pythonX.Y/encodings/' Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).