aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-09-19 18:09:04 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2016-09-19 18:09:04 +0100
commitd0f5943566482b094ac600e63271c22ebf227c5f (patch)
tree46ad3b6a3444deed677c1711da318f81ea00fec1
parent1993ff76f5f77f7c4597b9ca56a2712c3ed685bf (diff)
downloadgcc-d0f5943566482b094ac600e63271c22ebf227c5f.zip
gcc-d0f5943566482b094ac600e63271c22ebf227c5f.tar.gz
gcc-d0f5943566482b094ac600e63271c22ebf227c5f.tar.bz2
libstdc++/77645 fix deque and vector xmethods for Python 3
PR libstdc++/77645 * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__) (DequeWorkerBase.index, VectorWorkerBase.get): Cast results of division to int to work with Python 3. From-SVN: r240241
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/xmethods.py6
2 files changed, 8 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ee42cdf..011b900 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
2016-09-19 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/77645
+ * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__)
+ (DequeWorkerBase.index, VectorWorkerBase.get): Cast results of
+ division to int to work with Python 3.
+
* testsuite/lib/gdb-test.exp (gdb-test): Fail if Python error occurs.
* python/libstdcxx/v6/printers.py (SingleObjContainerPrinter): Allow
diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 95f9af9..71a5b75 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -165,7 +165,7 @@ class ArrayMethodsMatcher(gdb.xmethod.XMethodMatcher):
class DequeWorkerBase(gdb.xmethod.XMethodWorker):
def __init__(self, val_type):
self._val_type = val_type
- self._bufsize = (512 / val_type.sizeof) or 1
+ self._bufsize = int(512 / val_type.sizeof) or 1
def size(self, obj):
first_node = obj['_M_impl']['_M_start']['_M_node']
@@ -176,7 +176,7 @@ class DequeWorkerBase(gdb.xmethod.XMethodWorker):
def index(self, obj, idx):
first_node = obj['_M_impl']['_M_start']['_M_node']
- index_node = first_node + idx / self._bufsize
+ index_node = first_node + int(idx / self._bufsize)
return index_node[0][idx % self._bufsize]
class DequeEmptyWorker(DequeWorkerBase):
@@ -419,7 +419,7 @@ class VectorWorkerBase(gdb.xmethod.XMethodWorker):
if self._val_type.code == gdb.TYPE_CODE_BOOL:
start = obj['_M_impl']['_M_start']['_M_p']
bit_size = start.dereference().type.sizeof * 8
- valp = start + index / bit_size
+ valp = start + int(index / bit_size)
offset = index % bit_size
return (valp.dereference() & (1 << offset)) > 0
else: