Author: Armin Rigo <[email protected]>
Branch:
Changeset: r2885:e46941e99bf4
Date: 2017-02-06 09:33 +0100
http://bitbucket.org/cffi/cffi/changeset/e46941e99bf4/
Log: Remove a warning that doesn't really make sense here, tweak tests
diff --git a/c/minibuffer.h b/c/minibuffer.h
--- a/c/minibuffer.h
+++ b/c/minibuffer.h
@@ -173,12 +173,6 @@
if (rc < 0)
return NULL;
if (rc) {
- if (Py_BytesWarningFlag && (op == Py_EQ || op == Py_NE)) {
- if (PyErr_WarnEx(PyExc_BytesWarning,
- "Comparison between bytearray and string", 1))
- return NULL;
- }
-
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py
--- a/testing/cffi0/backend_tests.py
+++ b/testing/cffi0/backend_tests.py
@@ -1229,17 +1229,20 @@
def test_ffi_buffer_comparisons(self):
ffi = FFI(backend=self.Backend())
ba = bytearray(range(100, 110))
+ assert ba == memoryview(ba) # justification for the following
a = ffi.new("uint8_t[]", list(ba))
+ c = ffi.new("uint8_t[]", [99] + list(ba))
try:
b_full = ffi.buffer(a)
b_short = ffi.buffer(a, 3)
b_mid = ffi.buffer(a, 6)
+ b_other = ffi.buffer(c, 6)
except NotImplementedError as e:
py.test.skip(str(e))
else:
content = b_full[:]
assert content == b_full == ba
- assert b_short < b_mid < b_full
+ assert b_other < b_short < b_mid < b_full
assert ba > b_mid > ba[0:2]
assert b_short != ba[1:4]
diff --git a/testing/cffi0/test_ffi_backend.py
b/testing/cffi0/test_ffi_backend.py
--- a/testing/cffi0/test_ffi_backend.py
+++ b/testing/cffi0/test_ffi_backend.py
@@ -191,8 +191,11 @@
s = ffi.new("struct s1 *")
setattr(s, name, value)
assert getattr(s, name) == value
+ raw1 = ffi.buffer(s)[:]
buff1 = ffi.buffer(s)
t = lib.try_with_value(fnames.index(name), value)
+ raw2 = ffi.buffer(t, len(raw1))[:]
+ assert raw1 == raw2
buff2 = ffi.buffer(t, len(buff1))
assert buff1 == buff2
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit