Author: Alex Gaynor <alex.gay...@gmail.com> Branch: numpy-dtype-alt Changeset: r46894:69827a913a5d Date: 2011-08-29 12:27 -0400 http://bitbucket.org/pypy/pypy/changeset/69827a913a5d/
Log: you can't subclass dtype, thanks fijal 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 @@ -352,4 +352,5 @@ num = interp_attrproperty("num", cls=W_Dtype), kind = interp_attrproperty("kind", cls=W_Dtype), shape = GetSetProperty(W_Dtype.descr_get_shape), -) \ No newline at end of file +) +W_Dtype.typedef.acceptable_as_base_class = False \ No newline at end of file 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 @@ -92,4 +92,10 @@ def test_shape(self): from numpy import dtype - assert dtype(long).shape == () \ No newline at end of file + assert dtype(long).shape == () + + def test_cant_subclass(self): + from numpy import dtype + + # You can't subclass dtype + raises(TypeError, type, "Foo", (dtype,), {}) \ No newline at end of file _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit