Allow more Python scalar conversions
authorTom Tromey <tom@tromey.com>
Sat, 15 Sep 2018 04:31:12 +0000 (22:31 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 24 Sep 2018 05:12:59 +0000 (23:12 -0600)
commitfb4fa9469c5f5d87a956d45ed3b36fecc1fc31b9
tree67775531ba40c4164d51c62d66e95f7611a43811
parente6b5f1e9f5aace67505b4eff43570c82b56139b9
Allow more Python scalar conversions

PR python/18352 points out that the gdb Python code can't convert an
integer-valued gdb.Value to a Python float.  While writing the test I
noticed that, similarly, converting integer gdb.Values to float does
not work.  However, all of these cases seem reasonable.

gdb/ChangeLog
2018-09-23  Tom Tromey  <tom@tromey.com>

PR python/18352;
* python/py-value.c (valpy_float): Allow conversions from int or
char.
(valpy_int, valpy_long): Allow conversions from float.

gdb/testsuite/ChangeLog
2018-09-23  Tom Tromey  <tom@tromey.com>

PR python/18352;
* gdb.python/py-value.exp (test_float_conversion): New proc.
Use it.
gdb/ChangeLog
gdb/python/py-value.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-value.exp