[pypy-commit] pypy default: fix creation of dtype('c#')
bdkearns
noreply at buildbot.pypy.org
Fri Oct 18 07:46:29 CEST 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r67475:1b0b29ad2a80
Date: 2013-10-18 01:42 -0400
http://bitbucket.org/pypy/pypy/changeset/1b0b29ad2a80/
Log: fix creation of dtype('c#')
diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -432,7 +432,10 @@
size = int(name[1:])
except ValueError:
raise OperationError(space.w_TypeError, space.wrap("data type not understood"))
- if char == 'S' or char == 'c':
+ if char == 'c':
+ char = 'S'
+ size = 1
+ if char == 'S':
itemtype = types.StringType(size)
basename = 'string'
num = 18
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -800,6 +800,14 @@
assert d.type is str_
assert d.name == "string64"
assert d.num == 18
+ for i in [1, 2, 3]:
+ d = dtype('c%d' % i)
+ assert d.itemsize == 1
+ assert d.kind == 'S'
+ assert d.type is str_
+ assert d.name == 'string8'
+ assert d.num == 18
+ assert d.str == '|S1'
def test_unicode_dtype(self):
from numpypy import dtype, unicode_
More information about the pypy-commit
mailing list