summaryrefslogtreecommitdiff
path: root/dev-python/pytables/files/pytables-3.1.1-numpy19-backport.patch
blob: c2f0c2280f0140c8a55d2c5e3776e1324e8eef46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 854d5798ca9fd78c00e18710de2e93202f675f3e Mon Sep 17 00:00:00 2001
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sun, 6 Jul 2014 21:21:39 +0200
Subject: [PATCH] Fix a compatibility problem with numpy 1.9 (close: #362)

---
 RELEASE_NOTES.txt | 6 ++++++
 tables/table.py   | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index f219eb3..1da20e2 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -19,6 +19,12 @@ Improvements
   requiring strict access alignment.
 
 
+Bugs fixed
+----------
+
+- Fixed compatibitily problems with numpy 1.9 (closes :issue:`362`)
+
+
 Changes from 3.1.0 to 3.1.1
 ===========================
 
diff --git a/tables/table.py b/tables/table.py
index 235f599..ffe8fd6 100644
--- a/tables/table.py
+++ b/tables/table.py
@@ -3406,6 +3406,10 @@ def _getindex(self):
                      associated with this column (None if the column is not
                      indexed).""")
 
+    @lazyattr
+    def _itemtype(self):
+        return self.descr._v_dtypes[self.name]
+
     def _getshape(self):
         return (self.table.nrows,) + self.descr._v_dtypes[self.name].shape
 
@@ -3529,7 +3533,7 @@ def __iter__(self):
         table = self.table
         itemsize = self.dtype.itemsize
         nrowsinbuf = table._v_file.params['IO_BUFFER_SIZE'] // itemsize
-        buf = numpy.empty((nrowsinbuf, ), self.dtype)
+        buf = numpy.empty((nrowsinbuf, ), self._itemtype)
         max_row = len(self)
         for start_row in xrange(0, len(self), nrowsinbuf):
             end_row = min(start_row + nrowsinbuf, max_row)