aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-02-17 10:56:06 +0200
committerMatti Picus <matti.picus@gmail.com>2021-02-17 10:56:06 +0200
commit7029874c42f485f86ff1a353593ea526d963bef4 (patch)
tree7fad0b986ce3c44d189039d019abf66cc918dc60 /extra_tests
parentskip test on 32-bit (diff)
downloadpypy-7029874c42f485f86ff1a353593ea526d963bef4.tar.gz
pypy-7029874c42f485f86ff1a353593ea526d963bef4.tar.bz2
pypy-7029874c42f485f86ff1a353593ea526d963bef4.zip
update to cffi 1.14.5 (using pypy/tool/import_cffi.py and manually fixing too)
Diffstat (limited to 'extra_tests')
-rw-r--r--extra_tests/cffi_tests/test_c.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/extra_tests/cffi_tests/test_c.py b/extra_tests/cffi_tests/test_c.py
index d039edf00d..69ad15eb6c 100644
--- a/extra_tests/cffi_tests/test_c.py
+++ b/extra_tests/cffi_tests/test_c.py
@@ -17,7 +17,7 @@ from _cffi_backend import __version__
# ____________________________________________________________
import sys
-assert __version__ == "1.14.4", ("This test_c.py file is for testing a version"
+assert __version__ == "1.14.5", ("This test_c.py file is for testing a version"
" of cffi that differs from the one that we"
" get from 'import _cffi_backend'")
if sys.version_info < (3,):
@@ -3974,6 +3974,20 @@ def test_from_buffer_types():
with pytest.raises(ValueError):
release(pv[0])
+def test_issue483():
+ BInt = new_primitive_type("int")
+ BIntP = new_pointer_type(BInt)
+ BIntA = new_array_type(BIntP, None)
+ lst = list(range(25))
+ bytestring = bytearray(buffer(newp(BIntA, lst))[:] + b'XYZ')
+ p1 = from_buffer(BIntA, bytestring) # int[]
+ assert len(buffer(p1)) == 25 * size_of_int()
+ assert sizeof(p1) == 25 * size_of_int()
+ #
+ p2 = from_buffer(BIntP, bytestring)
+ assert sizeof(p2) == size_of_ptr()
+ assert len(buffer(p2)) == size_of_int() # first element only, by default
+
def test_memmove():
Short = new_primitive_type("short")
ShortA = new_array_type(new_pointer_type(Short), None)