2013-10-03 Phil Muldoon <pmuldoon@redhat.com>
* python/py-value.c (convert_value_from_python): Move PyInt_Check conversion logic to occur after PyLong_Check. Comment on order change significance. * python/py-arch.c (archpy_disassemble): Comment on order of conversion for integers and longs.
This commit is contained in:
parent
8ae377e842
commit
06ab7b19e0
3 changed files with 29 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2013-10-03 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* python/py-value.c (convert_value_from_python): Move PyInt_Check
|
||||||
|
conversion logic to occur after PyLong_Check. Comment on order
|
||||||
|
change significance.
|
||||||
|
* python/py-arch.c (archpy_disassemble): Comment on order of
|
||||||
|
conversion for integers and longs.
|
||||||
|
|
||||||
2013-10-03 Pedro Alves <palves@redhat.com>
|
2013-10-03 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* common/linux-ptrace.c (linux_check_ptrace_features): Factor out
|
* common/linux-ptrace.c (linux_check_ptrace_features): Factor out
|
||||||
|
|
|
@ -132,6 +132,13 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
start = start_temp;
|
start = start_temp;
|
||||||
if (end_obj)
|
if (end_obj)
|
||||||
{
|
{
|
||||||
|
/* Make a long logic check first. In Python 3.x, internally,
|
||||||
|
all integers are represented as longs. In Python 2.x, there
|
||||||
|
is still a differentiation internally between a PyInt and a
|
||||||
|
PyLong. Explicitly do this long check conversion first. In
|
||||||
|
GDB, for Python 3.x, we #ifdef PyInt = PyLong. This check has
|
||||||
|
to be done first to ensure we do not lose information in the
|
||||||
|
conversion process. */
|
||||||
if (PyLong_Check (end_obj))
|
if (PyLong_Check (end_obj))
|
||||||
end = PyLong_AsUnsignedLongLong (end_obj);
|
end = PyLong_AsUnsignedLongLong (end_obj);
|
||||||
else if (PyInt_Check (end_obj))
|
else if (PyInt_Check (end_obj))
|
||||||
|
|
|
@ -1265,13 +1265,13 @@ convert_value_from_python (PyObject *obj)
|
||||||
if (cmp >= 0)
|
if (cmp >= 0)
|
||||||
value = value_from_longest (builtin_type_pybool, cmp);
|
value = value_from_longest (builtin_type_pybool, cmp);
|
||||||
}
|
}
|
||||||
else if (PyInt_Check (obj))
|
/* Make a long logic check first. In Python 3.x, internally,
|
||||||
{
|
all integers are represented as longs. In Python 2.x, there
|
||||||
long l = PyInt_AsLong (obj);
|
is still a differentiation internally between a PyInt and a
|
||||||
|
PyLong. Explicitly do this long check conversion first. In
|
||||||
if (! PyErr_Occurred ())
|
GDB, for Python 3.x, we #ifdef PyInt = PyLong. This check has
|
||||||
value = value_from_longest (builtin_type_pyint, l);
|
to be done first to ensure we do not lose information in the
|
||||||
}
|
conversion process. */
|
||||||
else if (PyLong_Check (obj))
|
else if (PyLong_Check (obj))
|
||||||
{
|
{
|
||||||
LONGEST l = PyLong_AsLongLong (obj);
|
LONGEST l = PyLong_AsLongLong (obj);
|
||||||
|
@ -1306,6 +1306,13 @@ convert_value_from_python (PyObject *obj)
|
||||||
else
|
else
|
||||||
value = value_from_longest (builtin_type_pylong, l);
|
value = value_from_longest (builtin_type_pylong, l);
|
||||||
}
|
}
|
||||||
|
else if (PyInt_Check (obj))
|
||||||
|
{
|
||||||
|
long l = PyInt_AsLong (obj);
|
||||||
|
|
||||||
|
if (! PyErr_Occurred ())
|
||||||
|
value = value_from_longest (builtin_type_pyint, l);
|
||||||
|
}
|
||||||
else if (PyFloat_Check (obj))
|
else if (PyFloat_Check (obj))
|
||||||
{
|
{
|
||||||
double d = PyFloat_AsDouble (obj);
|
double d = PyFloat_AsDouble (obj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue