[pypy-svn] pypy default: Fix.

arigo commits-noreply at bitbucket.org
Wed Feb 16 15:52:31 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42042:9b5294bba4db
Date: 2011-02-16 15:49 +0100
http://bitbucket.org/pypy/pypy/changeset/9b5294bba4db/

Log:	Fix.

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
@@ -497,6 +497,7 @@
         raises(TypeError, _rawffi.Structure, [('A', 'c', 1)])
         raises(ValueError, _rawffi.Structure, [('A', 'I', 129)])
         raises(ValueError, _rawffi.Structure, [('A', 'I', -1)])
+        raises(ValueError, _rawffi.Structure, [('A', 'I', 0)])
 
     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
@@ -36,7 +36,7 @@
         if len_l == 3:
             bitsize = space.int_w(l_w[2])
 
-            if bitsize < 0 or bitsize > tp.size * 8:
+            if bitsize <= 0 or bitsize > tp.size * 8:
                 raise OperationError(space.w_ValueError, space.wrap(
                     "number of bits invalid for bit field"))
             for c in unroll_letters_for_numbers:


More information about the Pypy-commit mailing list