aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-02-19 17:35:46 +0100
committerCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-02-19 17:35:46 +0100
commit1bbb088bc502959f17f00cbc84302e88f5099d72 (patch)
tree641beccae0b8987384310e20d71469753966a33c
parentproperly mangle names for class annotations (diff)
parentworkaround for a crash when running test_recursive_pickle in test_functools on (diff)
downloadpypy-1bbb088bc502959f17f00cbc84302e88f5099d72.tar.gz
pypy-1bbb088bc502959f17f00cbc84302e88f5099d72.tar.bz2
pypy-1bbb088bc502959f17f00cbc84302e88f5099d72.zip
merge default
-rw-r--r--extra_tests/cffi_tests/test_c.py16
-rw-r--r--lib_pypy/cffi.egg-info/PKG-INFO2
-rw-r--r--lib_pypy/cffi/__init__.py4
-rw-r--r--lib_pypy/cffi/_embedding.h2
-rw-r--r--pypy/module/__pypy__/test/test_special.py7
-rw-r--r--pypy/module/_cffi_backend/__init__.py2
-rw-r--r--pypy/module/_cffi_backend/test/_backend_test_c.py2
-rw-r--r--pypy/module/_cppyy/capi/loadable_capi.py3
-rw-r--r--rpython/jit/tl/tla/targettla.py13
-rw-r--r--rpython/rlib/_rsocket_rffi.py4
-rw-r--r--rpython/rlib/rvmprof/cintf.py21
11 files changed, 56 insertions, 20 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)
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
index feeda7171d..5213c44c54 100644
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: cffi
-Version: 1.14.4
+Version: 1.14.5
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
index 644dea74c1..b79c21f91d 100644
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -5,8 +5,8 @@ from .api import FFI
from .error import CDefError, FFIError, VerificationError, VerificationMissing
from .error import PkgConfigError
-__version__ = "1.14.4"
-__version_info__ = (1, 14, 4)
+__version__ = "1.14.5"
+__version_info__ = (1, 14, 5)
# The verifier module file names are based on the CRC32 of a string that
# contains the following version number. It may be older than __version__
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
index cae179acb1..c36d79342d 100644
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -224,7 +224,7 @@ static int _cffi_initialize_python(void)
if (f != NULL && f != Py_None) {
PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
- "\ncompiled with cffi version: 1.14.4"
+ "\ncompiled with cffi version: 1.14.5"
"\n_cffi_backend module: ", f);
modules = PyImport_GetModuleDict();
mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/pypy/module/__pypy__/test/test_special.py b/pypy/module/__pypy__/test/test_special.py
index 26810fb9ea..4365f31082 100644
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -1,11 +1,11 @@
-import py
+import pytest
class AppTest(object):
spaceconfig = {"objspace.usemodules.select": False}
def setup_class(cls):
if cls.runappdirect:
- py.test.skip("does not make sense on pypy-c")
+ pytest.skip("does not make sense on pypy-c")
def test_cpumodel(self):
import __pypy__
@@ -128,7 +128,10 @@ class AppTest(object):
assert e.__traceback__ == tb
def test_instance_strategy(self):
+ import sys
from __pypy__ import strategy
+ if sys.maxsize < 2**32:
+ skip('not for 32-bit python')
class A(object):
pass
a = A()
diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
index 43fc4a2ac4..0a028af448 100644
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -1 +1 @@
-VERSION = "1.14.4"
+VERSION = "1.14.5"
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
index cd1e648917..ae93e126de 100644
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1,7 +1,7 @@
# ____________________________________________________________
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,):
diff --git a/pypy/module/_cppyy/capi/loadable_capi.py b/pypy/module/_cppyy/capi/loadable_capi.py
index a30aed0a3d..f1d59a2ff9 100644
--- a/pypy/module/_cppyy/capi/loadable_capi.py
+++ b/pypy/module/_cppyy/capi/loadable_capi.py
@@ -131,7 +131,8 @@ class W_RCTypeFunc(ctypefunc.W_CTypeFunc):
elif obj.tc == 'm':
misc.write_raw_signed_data(data, rffi.cast(rffi.INTPTR_T, obj._method), argtype.size)
elif obj.tc == 'o':
- misc.write_raw_signed_data(data, rffi.cast(rffi.VOIDP, obj._object), argtype.size)
+ # additional cast of void* to intptr_t required for 32b (or intmask fails)
+ misc.write_raw_signed_data(data, rffi.cast(rffi.INTPTR_T, rffi.cast(rffi.VOIDP, obj._object)), argtype.size)
elif obj.tc == 'u':
misc.write_raw_unsigned_data(data, rffi.cast(rffi.SIZE_T, obj._index), argtype.size)
elif obj.tc == 'i':
diff --git a/rpython/jit/tl/tla/targettla.py b/rpython/jit/tl/tla/targettla.py
index ad43cf3cf7..7b38b9cf6c 100644
--- a/rpython/jit/tl/tla/targettla.py
+++ b/rpython/jit/tl/tla/targettla.py
@@ -1,17 +1,18 @@
import py
py.path.local(__file__)
from rpython.jit.tl.tla import tla
+from rpython.rlib import jit
def entry_point(args):
- for i in range(len(argv)):
- if argv[i] == "--jit":
- if len(argv) == i + 1:
+ for i in range(len(args)):
+ if args[i] == "--jit":
+ if len(args) == i + 1:
print "missing argument after --jit"
return 2
- jitarg = argv[i + 1]
- del argv[i:i+2]
- jit.set_user_param(jitdriver, jitarg)
+ jitarg = args[i + 1]
+ del args[i:i+2]
+ jit.set_user_param(None, jitarg)
break
if len(args) < 3:
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
index 7eacf28f81..7a2b1bb91f 100644
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -924,7 +924,7 @@ if HAVE_SENDMSG:
These functions free memory that was allocated in C (sendmsg or recvmsg) was used in rsocket and now needs cleanup
*/
RPY_EXTERN
- int free_pointer_to_signedp(int** ptrtofree){
+ int free_pointer_to_signedp(long** ptrtofree){
free(*ptrtofree);
return 0;
}
@@ -958,7 +958,7 @@ if HAVE_SENDMSG:
"RPY_EXTERN "
"int memcpy_from_CCHARP_at_offset_and_size(char* stringfrom, char** stringto, int offset, int size);\n"
"RPY_EXTERN "
- "int free_pointer_to_signedp(int** ptrtofree);\n"
+ "int free_pointer_to_signedp(long** ptrtofree);\n"
"RPY_EXTERN "
"int free_ptr_to_charp(char** ptrtofree);\n"
]
diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
index c63e12d120..b8e9492789 100644
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -229,8 +229,25 @@ def jit_rvmprof_code(leaving, unique_id):
enter_code(unique_id) # ignore the return value
else:
s = vmprof_tl_stack.getraw()
- assert s.c_value == unique_id and s.c_kind == VMPROF_CODE_TAG
- leave_code(s)
+ if s.c_value == unique_id and s.c_kind == VMPROF_CODE_TAG:
+ leave_code(s)
+ else:
+ # this is a HACK! in some strange situations related to stack
+ # overflows we end up in a situation where the stack is not
+ # properly popped somewhere, so we end up with an extra entry.
+ # instead of crashing with an assertion error (which was done
+ # previously) try to fix the situation by popping of the stack
+ # twice. if that also gives the wrong unique_id we still crash with
+ # an assert.
+
+ # the test that found this problem is test_recursive_pickle in
+ # python3 test_functools.py
+ assert (s.c_next and s.c_next.c_value == unique_id and
+ s.c_next.c_kind == VMPROF_CODE_TAG)
+ s = vmprof_tl_stack.getraw()
+ leave_code(s)
+ s = vmprof_tl_stack.getraw()
+ leave_code(s)
#
# traceback support