Commit 9a9b8404 authored by Matti Picus's avatar Matti Picus
Browse files

merge default into release

--HG--
branch : release-pypy2.7-v7.x
Pipeline #27858 passed with stage
in 7 minutes and 30 seconds
......@@ -115,3 +115,6 @@ cd00c77c619f02c43c23e6a2514e5b685230ef02 release-pypy3.7-v7.3.5rc2
596a3d4905d6452b2ac871c1b39dea68418b4f64 release-pypy2.7-v7.3.5rc3
596a3d4905d6452b2ac871c1b39dea68418b4f64 release-pypy2.7-v7.3.5
77787b8f4c49115346d1e9cbaf48734137417738 release-pypy3.7-v7.3.5
dd033553d6918be9f2a72bb3ea03b3024bef2be2 release-pypy2.7-v7.3.6rc1
a5e5c18d11e9b7163722f1d31a723a4cb4a50f14 release-pypy3.7-v7.3.6rc1
7e233b73b92740ab7a20680a404ac100be1eb508 release-pypy3.8-v7.3.6rc1
import pytest
_pypy_util_cffi = pytest.importorskip('_pypy_util_cffi')
StackNew = _pypy_util_cffi.StackNew
def test_one():
with StackNew("char[]", 1) as p:
p[0] = b'\x13'
assert p[0] == b'\x13'
# assert did not crash
with StackNew("char*") as p:
pass
......@@ -30,6 +30,7 @@ from _cffi_ssl._stdssl.error import (SSL_ERROR_NONE,
SSL_ERROR_EOF, SSL_ERROR_NO_SOCKET, SSL_ERROR_INVALID_ERROR_CODE,
pyerr_write_unraisable)
from _cffi_ssl._stdssl import error
from _pypy_util_cffi import StackNew
from select import select
import socket
......@@ -417,7 +418,6 @@ class _SSLSocket(object):
return _decode_certificate(self.peer_cert)
def write(self, bytestring):
deadline = 0
b = _str_to_ffi_buffer(bytestring)
sock = self.get_socket_or_connection_gone()
ssl = self.ssl
......@@ -467,26 +467,70 @@ class _SSLSocket(object):
raise pyssl_error(self, length)
def read(self, length, buffer_into=None):
ssl = self.ssl
if length < 0 and buffer_into is None:
raise ValueError("size should not be negative")
if buffer_into is None:
return self._read_no_buf(length)
return self._read_buf(length, buffer_into)
def _read_no_buf(self, length):
ssl = self.ssl
sock = self.get_socket_or_connection_gone()
if buffer_into is None:
dest = ffi.new("char[]", length)
if length == 0:
return b""
if length == 0:
return b""
with StackNew("char[]", length) as dest:
mem = dest
else:
mem = ffi.from_buffer(buffer_into)
if length <= 0 or length > len(buffer_into):
length = len(buffer_into)
if length > _MAX_INT:
raise OverflowError("maximum length can't fit in a C 'int'")
if len(buffer_into) == 0:
return 0
if sock:
timeout = _socket_timeout(sock)
nonblocking = timeout >= 0
lib.BIO_set_nbio(lib.SSL_get_rbio(ssl), nonblocking)
lib.BIO_set_nbio(lib.SSL_get_wbio(ssl), nonblocking)
timeout = _socket_timeout(sock)
shutdown = False
while True:
count = lib.SSL_read(self.ssl, mem, length);
err = lib.SSL_get_error(self.ssl, count);
check_signals()
if err == SSL_ERROR_WANT_READ:
sockstate = _ssl_select(sock, 0, timeout)
elif err == SSL_ERROR_WANT_WRITE:
sockstate = _ssl_select(sock, 1, timeout)
elif err == SSL_ERROR_ZERO_RETURN and \
lib.SSL_get_shutdown(self.ssl) == lib.SSL_RECEIVED_SHUTDOWN:
shutdown = True
break;
else:
sockstate = SOCKET_OPERATION_OK
if sockstate == SOCKET_HAS_TIMED_OUT:
raise socket.timeout("The read operation timed out")
elif sockstate == SOCKET_IS_NONBLOCKING:
break
if not (err == SSL_ERROR_WANT_READ or err == SSL_ERROR_WANT_WRITE):
break
if count <= 0 and not shutdown:
raise pyssl_error(self, count)
return _bytes_with_len(dest, count)
def _read_buf(self, length, buffer_into):
ssl = self.ssl
sock = self.get_socket_or_connection_gone()
mem = ffi.from_buffer(buffer_into)
if length <= 0 or length > len(buffer_into):
length = len(buffer_into)
if length > _MAX_INT:
raise OverflowError("maximum length can't fit in a C 'int'")
if len(buffer_into) == 0:
return 0
if sock:
timeout = _socket_timeout(sock)
......@@ -494,7 +538,6 @@ class _SSLSocket(object):
lib.BIO_set_nbio(lib.SSL_get_rbio(ssl), nonblocking)
lib.BIO_set_nbio(lib.SSL_get_wbio(ssl), nonblocking)
deadline = 0
timeout = _socket_timeout(sock)
shutdown = False
while True:
......@@ -524,9 +567,6 @@ class _SSLSocket(object):
if count <= 0 and not shutdown:
raise pyssl_error(self, count)
if not buffer_into:
return _bytes_with_len(dest, count)
return count
if HAS_ALPN:
......
from cffi import FFI as _FFI
_ffi = _FFI()
_ffi.cdef("""
void* malloc(size_t size);
void free(void *ptr);
""")
_ffi.set_source("_pypy_util_cffi_inner", "")
if __name__ == '__main__':
_ffi.compile()
from _pypy_util_cffi_inner import ffi, lib
class StackNew(object):
def __init__(self, tp, size=None):
if size is None:
total_size = ffi.sizeof(tp)
else:
if tp.endswith("[]"):
total_size = ffi.sizeof(tp[:-2] + "[1]") * size
else:
total_size = ffi.sizeof(tp) * size
if tp.endswith("[]"):
tp = tp[:-2] + "*" # XXX dodgu?
self._p = ffi.cast(tp, lib.malloc(total_size))
def __enter__(self):
return self._p
def __exit__(self, tp, val, tb):
lib.free(ffi.cast("void*", self._p))
......@@ -25,6 +25,7 @@ class MissingDependenciesError(Exception):
cffi_build_scripts = collections.OrderedDict({
("_ctypes._ctypes_cffi",
"_ctypes/_ctypes_build.py" if sys.platform == 'darwin' else None),
("_pypy_util_cffi_inner", "_pypy_util_build.py"), # this needs to come before ssl
("_ssl", "_ssl_build.py"),
("sqlite3", "_sqlite3_build.py"),
("audioop", "_audioop_build.py"),
......
......@@ -520,7 +520,7 @@ completely deleted.)
What is needed for better Windows 64 support of PyPy?
-----------------------------------------------
-----------------------------------------------------
As of PyPy 7.3.5, PyPy supports Windows 64-bits. Since only on that platform
``sizeof(long) != sizeof(void *)``, and the underlying data type for RPython is
......
......@@ -7,6 +7,7 @@ CPython 2.7 compatible versions
.. toctree::
whatsnew-head.rst
whatsnew-pypy2-7.3.6.rst
whatsnew-pypy2-7.3.4.rst
whatsnew-pypy2-7.3.3.rst
whatsnew-pypy2-7.3.2.rst
......
......@@ -33,24 +33,18 @@ releases. Highlights of the release, since the release of 7.3.5 in May 2021,
include:
- We have merged a backend for HPy_, the better C-API interface. The backend
implements version 0.0.2.
implements version 0.0.3.
- Translation of PyPy into a binary, known to be slow, is now about 40%
faster. On a modern machine, PyPy3.8 can translate in about 20 minutes.
- PyPy Windows 64 is now available on conda-forge_, along with over 580
- PyPy Windows 64 is now available on conda-forge_, along with over 600
commonly used binary packages. This new offering joins the more than 1000
conda packages for PyPy on Linux and macOS. Many thanks to the conda-forge
maintainers for pushing this forward over the past 18 months.
- Speed improvements were made to ``io``, ``sum``, ``_ssl`` and more. These
were done in response to user feedback.
- The 3.8 version of the release contains a beta-quality improvement to the
JIT. We now better handle situations where a lot of Python code from the
same function is turned into machine code, without any inlining. This can
happen when Python code gets automatically generated, for
example by a string templating engine. Previously, this would either fail
to compile or compile very slowly. Performance by the JIT could thus be
worse than even the non-JITted interpreter (issue 3402_).
In the released 3.8 version we solve this problem by breaking the
function into smaller chunks and compiling them step by step.
JIT to better support `compiling huge Python functions`_ by breaking them
up into smaller pieces.
- The release of Python3.8 required a concerted effort. We were greatly
helped by @isidentical (Batuhan Taskaya) and other new contributors.
- The 3.8 package now uses the same layout as CPython, and many of the
......@@ -62,6 +56,8 @@ include:
``pypy`` prefix to prevent mixing the files with CPython (which uses
``python``.
.. _`compiling huge Python functions`: https://www.pypy.org/posts/2021/09/jit-auto-generated-code.html
We recommend updating. You can find links to download the v7.3.6 releases here:
......@@ -165,6 +161,9 @@ Speedups and enhancements shared across versions
3538_)
- Switch to "powersort" merging strategy by Munro and Wild instead the timsort
algorithm (`bpo 34561`_)
- Check env keys for ``'='`` when calling ``os.execve``
- Provide a PyPy-only scoped way to malloc buffers in cffi and use it in
``ssl.read``
C-API (cpyext) and C-extensions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -176,7 +175,7 @@ Python 3.7+ bugfixes
--------------------
- Fix MemoryError on zip.read in shutil._unpack_zipfile for large files `bpo
43650`_
- Fix some issues around the ``obj`` field of ``memoryview``s, and add missing
- Fix some issues around the ``obj`` field of ``memoryview``, and add missing
``toreadonly``.
- Fix ``re.sub()`` with no match and with unusual types of arguments (issue
3515_)
......@@ -205,7 +204,6 @@ Python 3.7+ speedups and enhancements
- Support HPy 0.0.2
- Use CPython list of consts in ``os.{confstr,pathconf,sysconf}_names`` (issue
3502_)
- Check env keys for ``'='`` when calling ``os.execve``
- Add ``_winapi.GetFileType`` and ``FILE_TYPE_*`` values (issue 3531_)
- Allow ``ctypes.POINTER()`` to cast `ctypes.array`` (issue 3546_)
- Update the stdlib to v3.7.12
......@@ -215,7 +213,7 @@ Python 3.7 C-API
- Add PEP 495 c-api ``TimeAndFold`` datetime constructors (issue 2987_)
- Allow ``NULL`` in ``PyErr_WriteUnraisable`` (issue 3353_)
- Support ``*TimeZone*`` functions in datetime
- Add slot functions so ``int(x)`` and ``float(x)` work properly where
- Add slot functions so ``int(x)`` and ``float(x)`` work properly where
``x`` is a c-extension class
- When creating a ``PyUnicodeObject``, use the compact form to store the data
directly on the object and not via an additional buffer. This is used in
......
......@@ -3,10 +3,6 @@ What's new in PyPy2.7 7.3.6+
============================
.. this is a revision shortly after release-pypy-7.3.6
.. startrev: 000a308e967f
.. startrev: 0012ea4931c1
.. branch: win64-stat
Add ``st_file_attributes`` and ``st_reparse_tag`` attributes to ``os.stat``
on windows. Also follow the reparse logic of Python3.8.
......@@ -53,3 +53,12 @@ returning from a call
.. branch: no-make-portable
Add an option to package pypy non-portably
.. branch: win64-stat
Add ``st_file_attributes`` and ``st_reparse_tag`` attributes to ``os.stat``
on windows. Also follow the reparse logic of Python3.8.
.. branch: scoped-cffi-malloc
Adds a scoped way to malloc buffers to cffi and use it in ``ssl.read``
......@@ -343,8 +343,10 @@ class TestInstance(BaseTestPyPyC):
guard_value(p67, ConstPtr(ptr68), descr=...) # promote map
guard_not_invalidated(descr=...)
p69 = getfield_gc_r(p63, descr=...) # value0
f71 = getarrayitem_gc_f(p69, 0, descr=...) # x
f73 = getarrayitem_gc_f(p69, 1, descr=...) # y
i71 = getarrayitem_gc_i(p69, 0, descr=...) # x
f71 = convert_longlong_bytes_to_float(i71)
i73 = getarrayitem_gc_i(p69, 1, descr=...) # y
f73 = convert_longlong_bytes_to_float(i73)
f74 = float_add(f71, f73) # add them
f75 = float_add(f57, f74)
--TICK--
......@@ -367,10 +369,12 @@ class TestInstance(BaseTestPyPyC):
guard_value(p60, ConstPtr(ptr61), descr=...)
guard_not_invalidated(descr=...)
p62 = getfield_gc_r(p56, descr=...) # value
f64 = getarrayitem_gc_f(p62, 0, descr=...) # x
i64 = getarrayitem_gc_i(p62, 0, descr=...) # x
f64 = convert_longlong_bytes_to_float(i64)
f66 = float_add(f64, 3.400000)
i66 = convert_float_bytes_to_longlong(f66)
i68 = getfield_raw_i(..., descr=...)
setarrayitem_gc(p62, 0, f66, descr=...) # store x
setarrayitem_gc(p62, 0, i66, descr=...) # store x
i71 = int_lt(i68, 0)
guard_false(i71, descr=...)
""")
......
......@@ -505,16 +505,16 @@ class UnboxedPlainAttribute(PlainAttribute):
space = self.space
assert type(w_value) is self.typ
if type(w_value) is space.IntObjectCls:
return longlong2float(space.int_w(w_value))
return space.int_w(w_value)
else:
return space.float_w(w_value)
return float2longlong(space.float_w(w_value))
def _box(self, val):
space = self.space
if self.typ is space.IntObjectCls:
return space.newint(float2longlong(val))
return space.newint(val)
else:
return space.newfloat(val)
return space.newfloat(longlong2float(val))
def _convert_to_boxed(self, obj):
new_obj = obj._get_mapdict_map().copy(obj)
......
......@@ -2,7 +2,6 @@ import pytest
from pypy.objspace.std.test.test_dictmultiobject import FakeSpace, W_DictObject
from pypy.objspace.std.mapdict import *
skip_if_no_int_unboxing = pytest.mark.skipif(not ALLOW_UNBOXING_INTS, reason="int unboxing disabled on 32bit")
class Config:
......@@ -571,34 +570,54 @@ def test_unboxed_storage_needed():
int)
assert aa.storage_needed() == 2
@skip_if_no_int_unboxing
def test_unboxed_write_int():
def unboxed_write_int(val1, val2):
cls = Class(allow_unboxing=True)
w_obj = cls.instantiate(space)
w_obj.setdictvalue(space, "a", 15)
w_obj.getdictvalue(space, "a") == 15
w_obj.setdictvalue(space, "a", val1)
w_obj.getdictvalue(space, "a") == val1
assert isinstance(w_obj.map, UnboxedPlainAttribute)
w_obj.setdictvalue(space, "b", 20)
w_obj.getdictvalue(space, "b") == 20
w_obj.getdictvalue(space, "a") == 15
w_obj.setdictvalue(space, "b", val2)
w_obj.getdictvalue(space, "b") == val2
w_obj.getdictvalue(space, "a") == val1
assert isinstance(w_obj.map, UnboxedPlainAttribute)
assert isinstance(w_obj.map.back, UnboxedPlainAttribute)
assert unerase_unboxed(w_obj.storage[0]) == [longlong2float(15), longlong2float(20)]
assert unerase_unboxed(w_obj.storage[0]) == [val1, val2]
def test_unboxed_write_float():
def unboxed_write_float(val1, val2):
cls = Class(allow_unboxing=True)
w_obj = cls.instantiate(space)
w_obj.setdictvalue(space, "a", 15.0)
w_obj.getdictvalue(space, "a") == 15.0
w_obj.setdictvalue(space, "a", val1)
w_obj.getdictvalue(space, "a") == val1
assert isinstance(w_obj.map, UnboxedPlainAttribute)
w_obj.setdictvalue(space, "b", 20.0)
w_obj.getdictvalue(space, "b") == 20.0
w_obj.getdictvalue(space, "a") == 15.0
w_obj.setdictvalue(space, "b", val2)
w_obj.getdictvalue(space, "b") == val2
w_obj.getdictvalue(space, "a") == val1
assert isinstance(w_obj.map, UnboxedPlainAttribute)
assert isinstance(w_obj.map.back, UnboxedPlainAttribute)
assert unerase_unboxed(w_obj.storage[0]) == [15.0, 20.0]
assert unerase_unboxed(w_obj.storage[0]) == [
float2longlong(val1), float2longlong(val2)]
try:
from hypothesis import given, strategies
except ImportError:
@skip_if_no_int_unboxing
def test_unboxed_write_int():
unboxed_write_int(15, 20)
def test_unboxed_write_float():
unboxed_write_float(12.434, -1e17)
else:
@skip_if_no_int_unboxing
@given(strategies.integers(-sys.maxint-1, sys.maxint),
strategies.integers(-sys.maxint-1, sys.maxint))
def test_unboxed_write_int(val1, val2):
unboxed_write_int(val1, val2)
@given(strategies.floats(), strategies.floats())
def test_unboxed_write_float(val1, val2):
unboxed_write_float(val1, val2)
@skip_if_no_int_unboxing
def test_unboxed_write_mixed():
......@@ -684,7 +703,7 @@ def test_unboxed_attr_immutability(monkeypatch):
def _pure_unboxed_read(obj):
indices.append(0)
return 10.12
return float2longlong(10.12)
obj.map.back._pure_unboxed_read = _pure_unboxed_read
monkeypatch.setattr(jit, "isconstant", lambda c: True)
......
......@@ -33,6 +33,9 @@ def assert_in(a, b):
pypy_versions = {
'7.3.6rc1': {'python_version': ['3.8.12', '3.7.12', '2.7.18'],
'date': '2021-09-13',
},
'7.3.5': {'python_version': ['3.7.10', '2.7.18'],
'date': '2021-05-23',
},
......
#! /bin/bash
# Edit these appropriately before running this script
pmaj=3 # python main version: 2 or 3
pmaj=2 # python main version: 2 or 3
pmin=7 # python minor version
maj=7
min=3
rev=5
# rc=rc3 # comment this line for actual release
rev=6
rc=rc1 # comment this line for actual release
function maybe_exit {
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
......@@ -71,7 +71,12 @@ function repackage_builds {
rm pypy-c-jit-latest-$plat.tar.bz2
# Check that this is the correct version
actual_ver=$(grep PYPY_VERSION pypy-c-jit-*-$plat/include/patchlevel.h |cut -f3 -d' ')
if [ "$pmin" == "7" ] # python2.7, 3.7
then
actual_ver=$(grep PYPY_VERSION pypy-c-jit-*-$plat/include/patchlevel.h |cut -f3 -d' ')
else
actual_ver=$(grep PYPY_VERSION pypy-c-jit-*-$plat/include/pypy$pmaj.$pmin/patchlevel.h |cut -f3 -d' ')
fi
if [ $actual_ver != "\"$maj.$min.$rev\"" ]
then
echo xxxxxxxxxxxxxxxxxxxxxx
......@@ -93,7 +98,7 @@ function repackage_builds {
rm -rf $rel-$plat_final
done
# end of "for" loop
for plat in win64 win32
for plat in win64 # win32
do
if wget -q --show-progress http://buildbot.pypy.org/nightly/$branchname/pypy-c-jit-latest-$plat.zip
then
......
[
{
"pypy_version": "7.3.6rc1",
"python_version": "3.8.12",
"stable": false,
"latest_pypy": false,
"date": "2021-09-13",
"files": [
{
"filename": "pypy3.8-v7.3.6rc1-aarch64.tar.bz2",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-aarch64.tar.bz2"
},
{
"filename": "pypy3.8-v7.3.6rc1-linux32.tar.bz2",
"arch": "i686",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-linux32.tar.bz2"
},
{
"filename": "pypy3.8-v7.3.6rc1-linux64.tar.bz2",
"arch": "x64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-linux64.tar.bz2"
},
{
"filename": "pypy3.8-v7.3.6rc1-osx64.tar.bz2",
"arch": "x64",
"platform": "darwin",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-osx64.tar.bz2"
},
{
"filename": "pypy3.8-v7.3.6rc1-win64.zip",
"arch": "x64",
"platform": "win64",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-win64.zip"
},
{
"filename": "pypy3.8-v7.3.6rc1-s390x.tar.bz2",
"arch": "s390x",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.8-v7.3.6rc1-s390x.tar.bz2"
}
]
},
{
"pypy_version": "7.3.6rc1",
"python_version": "3.7.12",
"stable": false,
"latest_pypy": false,
"date": "2021-09-13",
"files": [
{
"filename": "pypy3.7-v7.3.6rc1-aarch64.tar.bz2",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-aarch64.tar.bz2"
},
{
"filename": "pypy3.7-v7.3.6rc1-linux32.tar.bz2",
"arch": "i686",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-linux32.tar.bz2"
},
{
"filename": "pypy3.7-v7.3.6rc1-linux64.tar.bz2",
"arch": "x64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-linux64.tar.bz2"
},
{
"filename": "pypy3.7-v7.3.6rc1-osx64.tar.bz2",
"arch": "x64",
"platform": "darwin",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-osx64.tar.bz2"
},
{
"filename": "pypy3.7-v7.3.6rc1-win64.zip",
"arch": "x64",
"platform": "win64",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-win64.zip"
},
{
"filename": "pypy3.7-v7.3.6rc1-s390x.tar.bz2",
"arch": "s390x",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy3.7-v7.3.6rc1-s390x.tar.bz2"
}
]
},
{
"pypy_version": "7.3.6rc1",
"python_version": "2.7.18",
"stable": false,
"latest_pypy": false,
"date": "2021-09-13",
"files": [
{
"filename": "pypy2.7-v7.3.6rc1-aarch64.tar.bz2",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy2.7-v7.3.6rc1-aarch64.tar.bz2"
},
{
"filename": "pypy2.7-v7.3.6rc1-linux32.tar.bz2",
"arch": "i686",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy2.7-v7.3.6rc1-linux32.tar.bz2"
},
{
"filename": "pypy2.7-v7.3.6rc1-linux64.tar.bz2",
"arch": "x64",
"platform": "linux",
"download_url": "https://downloads.python.org/pypy/pypy2.7-v7.3.6rc1-linux64.tar.bz2"
},
{
"filename": "pypy2.7-v7.3.6rc1-osx64.tar.bz2",
"arch": "x64",
"platform": "darwin",
"download_url": "https://downloads.python.org/pypy/pypy2.7-v7.3.6rc1-osx64.tar.bz2"