[pypy-svn] pypy default: We get a TypeError on CPython, not a ValueError.

arigo commits-noreply at bitbucket.org
Wed Feb 16 15:44:36 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42039:23785f57e97a
Date: 2011-02-16 15:40 +0100
http://bitbucket.org/pypy/pypy/changeset/23785f57e97a/

Log:	We get a TypeError on CPython, not a ValueError.

diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py
--- a/pypy/module/_rawffi/test/test__rawffi.py
+++ b/pypy/module/_rawffi/test/test__rawffi.py
@@ -494,9 +494,9 @@
 
     def test_invalid_bitfields(self):
         import _rawffi
-        raises(ValueError, _rawffi.Structure, [('A', 'c', 1)])
-        raises(ValueError, _rawffi.Structure, [('A', 'I', 129)])
-        raises(ValueError, _rawffi.Structure, [('A', 'I', -1)])
+        raises(TypeError, _rawffi.Structure, [('A', 'c', 1)])
+        raises(TypeError, _rawffi.Structure, [('A', 'I', 129)])
+        raises(TypeError, _rawffi.Structure, [('A', 'I', -1)])
 
     def test_packed_structure(self):
         import _rawffi

diff --git a/pypy/module/_rawffi/structure.py b/pypy/module/_rawffi/structure.py
--- a/pypy/module/_rawffi/structure.py
+++ b/pypy/module/_rawffi/structure.py
@@ -43,7 +43,7 @@
                 if c == tp.itemcode:
                     break
             else:
-                raise OperationError(space.w_ValueError, space.wrap(
+                raise OperationError(space.w_TypeError, space.wrap(
                     "bit fields not allowed for type"))
         else:
             bitsize = 0


More information about the Pypy-commit mailing list