aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-09-22 21:14:58 +0000
committerTom Tromey <tromey@redhat.com>2009-09-22 21:14:58 +0000
commit89fa5381cbd8e13fe859f458ac0f46e13f7ea1c1 (patch)
treee1de7e4c9d099c608794976351a062774a61574d
parent6a8f49fe0ad07100d352d23ff5d071b59a1a9230 (diff)
downloadfsf-binutils-gdb-89fa5381cbd8e13fe859f458ac0f46e13f7ea1c1.zip
fsf-binutils-gdb-89fa5381cbd8e13fe859f458ac0f46e13f7ea1c1.tar.gz
fsf-binutils-gdb-89fa5381cbd8e13fe859f458ac0f46e13f7ea1c1.tar.bz2
PR gdb/10583:
* python/py-value.c (valpy_int): Use PyLong_FromLongLong. (valpy_long): Likewise.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/python/py-value.c11
2 files changed, 17 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51cee9a..4b443ab 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2009-09-22 Tom Tromey <tromey@redhat.com>
+ PR gdb/10583:
+ * python/py-value.c (valpy_int): Use PyLong_FromLongLong.
+ (valpy_long): Likewise.
+
+2009-09-22 Tom Tromey <tromey@redhat.com>
+
PR python/10680:
* eval.c (evaluate_subexp_standard) <do_call_it>: Handle internal
functions in EVAL_AVOID_SIDE_EFFECTS case.
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 714aa11..58bcee3 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -784,6 +784,13 @@ valpy_int (PyObject *self)
}
GDB_PY_HANDLE_EXCEPTION (except);
+#ifdef HAVE_LONG_LONG /* Defined by Python. */
+ /* If we have 'long long', and the value overflows a 'long', use a
+ Python Long; otherwise use a Python Int. */
+ if (sizeof (l) > sizeof (long) && (l > PyInt_GetMax ()
+ || l < (- (LONGEST) PyInt_GetMax ()) - 1))
+ return PyLong_FromLongLong (l);
+#endif
return PyInt_FromLong (l);
}
@@ -808,7 +815,11 @@ valpy_long (PyObject *self)
}
GDB_PY_HANDLE_EXCEPTION (except);
+#ifdef HAVE_LONG_LONG /* Defined by Python. */
+ return PyLong_FromLongLong (l);
+#else
return PyLong_FromLong (l);
+#endif
}
/* Implements conversion to float. */