[pypy-commit] cffi default: Fix the test (by changing it), and fix the test (by changing the tested

arigo noreply at buildbot.pypy.org
Thu Jun 7 21:14:29 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r268:6831272b36f6
Date: 2012-06-07 21:14 +0200
http://bitbucket.org/cffi/cffi/changeset/6831272b36f6/

Log:	Fix the test (by changing it), and fix the test (by changing the
	tested code).

diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c
--- a/c/_ffi_backend.c
+++ b/c/_ffi_backend.c
@@ -813,7 +813,7 @@
         fmin = 0LL;
         fmax = (PY_LONG_LONG)((1ULL << cf->cf_bitsize) - 1ULL);
     }
-    if (value < fmin || value > fmax) {
+    if ((value < fmin || value > fmax) && value != 1) {
         PyErr_Format(PyExc_OverflowError,
                      "value %lld outside the range allowed by the "
                      "bit field width: %lld <= x <= %llx",
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -690,7 +690,7 @@
     p.a1 = -1
     assert p.a1 == -1
     p.a1 = 0
-    py.test.raises(OverflowError, "p.a1 = 1")
+    py.test.raises(OverflowError, "p.a1 = 2")
     assert p.a1 == 0
     #
     p.a1 = -1


More information about the pypy-commit mailing list