Author: Brian Kearns <[email protected]>
Branch:
Changeset: r68131:21243450f85a
Date: 2013-11-15 01:22 -0500
http://bitbucket.org/pypy/pypy/changeset/21243450f85a/
Log: support dtype('|S#')
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
@@ -390,7 +390,7 @@
return cache.dtypes_by_name[name]
except KeyError:
pass
- if name[0] in 'VSUc' or name[0] in '<>=' and name[1] in 'VSUc':
+ if name[0] in 'VSUc' or name[0] in '<>=|' and name[1] in 'VSUc':
return variable_dtype(space, name)
raise OperationError(space.w_TypeError, space.wrap(
"data type %s not understood" % name))
@@ -452,7 +452,7 @@
def variable_dtype(space, name):
- if name[0] in '<>=':
+ if name[0] in '<>=|':
name = name[1:]
char = name[0]
if len(name) == 1:
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
@@ -828,13 +828,14 @@
from numpypy import dtype, str_
raises(TypeError, "dtype('Sx')")
- d = dtype('S8')
- assert d.itemsize == 8
- assert dtype(str) == dtype('S')
- assert d.kind == 'S'
- assert d.type is str_
- assert d.name == "string64"
- assert d.num == 18
+ for t in ['S8', '|S8', '=S8']:
+ d = dtype(t)
+ assert d.itemsize == 8
+ assert dtype(str) == dtype('S')
+ assert d.kind == 'S'
+ 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
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit