Commit ffdae2fd authored by Matti Picus's avatar Matti Picus
Browse files

merge default into py3.7

--HG--
branch : py3.7
Pipeline #21626 passed with stage
in 8 minutes and 56 seconds
......@@ -107,3 +107,5 @@ db1e853f94de42ad711bd930222bd2434e0f900d release-pypy3.6-v7.3.3
51efa818fd9b24f625078c65e8e2f6a5ac24d572 release-pypy3.7-v7.3.4rc2
63df5ef41012b07fa6f9eaba93f05de0eb540f88 release-pypy2.7-v7.3.4
51efa818fd9b24f625078c65e8e2f6a5ac24d572 release-pypy3.7-v7.3.4
e02eba563ef8ad7b5097acd72a81ae1f8ddda796 release-pypy2.7-v7.3.5rc1
d770377ff27b810daef22c770e669ec9542363fe release-pypy3.7-v7.3.5rc1
......@@ -12,11 +12,18 @@ We are releasing a PyPy 7.3.5 with bugfixes for PyPy 7.3.4, released April 4.
- The new windows 64-bit builds improperly named c-extension modules
with the same extension as the 32-bit build (issue 3443_)
- Use the windows-specific ``PC/pyconfig.h`` rather than the posix one
- A change to the python 3.7 ``sysconfig.get_config_var('LIBDIR')`` was wrong,
leading to problems finding `libpypy3-c.so` for embedded PyPy (issue 3442_).
- Two upstream (CPython) security patches were applied: `BPO 42988`_ to remove
``pydoc.getfile`` and `BPO 43285`_ to not trust the ``PASV`` response in
``ftplib``.
- Instantiate ``distutils.command.install`` schema for PyPy-specific
``implementation_lower``
- Four upstream (CPython) security patches were applied:
- `BPO 42988`_ to remove ``pydoc.getfile``
- `BPO 43285`_ to not trust the ``PASV`` response in ``ftplib``.
- `BPO 43075`_ to remove a possible ReDoS in urllib AbstractBasicAuthHandler
- `BPO 43882`_ to sanitize urls containing ASCII newline and tabs in
``urllib.parse``
- When assigning the full slice of a list, evaluate the rhs before clearing the
list (issue 3440_)
- On Python2, ``PyUnicode_Contains`` accepts bytes as well as unicode.
......@@ -87,4 +94,6 @@ PyPy does support ARM 32 bit processors, but does not release binaries.
.. _3440: https://foss.heptapod.net/pypy/pypy/-/issues/3440
.. _`BPO 42988`: https://bugs.python.org/issue42988
.. _`BPO 43285`: https://bugs.python.org/issue43285
.. _`BPO 43075`: https://bugs.python.org/issue43075
.. _`BPO 43882`: https://bugs.python.org/issue43882
......@@ -16,3 +16,10 @@ formatting of big numbers.
Optimize dictionary operations in the JIT a bit more, making it possible to
completely optimize away the creation of dictionaries in more situations (such
as calling the ``dict.update`` method on known dicts).
.. branch: bpo-35714
Add special error messange for ``'\0'`` in ``rstruct.formatiterator``
(bpo-35714)
.. minor branches not worth to document
.. branch: fix-checkmodule-2
import sys
from pypy.interpreter.mixedmodule import MixedModule
class Module(MixedModule):
......
......@@ -140,6 +140,7 @@ Py_TPFLAGS_HEAPTYPE
Py_LT Py_LE Py_EQ Py_NE Py_GT Py_GE Py_MAX_NDIMS
Py_CLEANUP_SUPPORTED PyBUF_READ
PyBUF_FORMAT PyBUF_ND PyBUF_STRIDES PyBUF_WRITABLE PyBUF_SIMPLE PyBUF_WRITE
PY_SSIZE_T_MAX PY_SSIZE_T_MIN
""".split()
for name in ('LONG', 'LIST', 'TUPLE', 'UNICODE', 'DICT', 'BASE_EXC',
......
from pypy.interpreter.error import OperationError, oefmt
from pypy.module.cpyext.api import cpython_api, CANNOT_FAIL, Py_ssize_t
from pypy.module.cpyext.pyobject import PyObject
from pypy.module.cpyext.api import (
cpython_api, CANNOT_FAIL, Py_ssize_t, PyVarObject, PY_SSIZE_T_MAX,
PY_SSIZE_T_MIN)
from pypy.module.cpyext.pyobject import PyObject, PyObjectP, from_ref, make_ref
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rarithmetic import widen
from rpython.tool.sourcetools import func_with_new_name
......@@ -42,7 +44,22 @@ def PyNumber_AsSsize_t(space, w_obj, w_exc):
exception is cleared and the value is clipped to PY_SSIZE_T_MIN for a negative
integer or PY_SSIZE_T_MAX for a positive integer.
"""
return space.int_w(w_obj) #XXX: this is wrong on win64
try:
return space.int_w(w_obj) #XXX: this is wrong on win64
except OperationError as e:
if e.match(space, space.w_OverflowError):
if not w_exc:
# CPython does _PyLong_Sign(value) < 0 which is equivalent to
# Py_SIZE(value) < 0 which is value->ob_size
pyobj = make_ref(space, w_obj)
if rffi.cast(PyVarObject, pyobj).c_ob_size < 0:
return PY_SSIZE_T_MIN
else:
return PY_SSIZE_T_MAX
else:
raise oefmt(w_exc, "cannot fit '%T' into an index-sized integer", w_obj)
else:
raise
@cpython_api([PyObject], PyObject)
def PyNumber_Long(space, w_obj):
......
......@@ -158,3 +158,29 @@ class AppTestCNumber(AppTestCpythonExtensionBase):
assert mod.check_index(m)
m = Missing()
assert not mod.check_index(m)
def test_number_to_ssize_t(self):
import sys
mod = self.import_extension('foo', [
("to_ssize_t", "METH_VARARGS",
"""
PyObject *obj;
PyObject *exc = NULL;
long long value;
if (!PyArg_ParseTuple(args, "O|O:to_ssize_t",
&obj, &exc)) {
return NULL;
}
if (exc == NULL) {
printf("got no exc\\n");
} else {
printf("got exc\\n");
}
value = PyNumber_AsSsize_t(obj, exc);
if (PyErr_Occurred()) {
return NULL;
}
return PyLong_FromLongLong(value);
""")])
assert mod.to_ssize_t(2 ** 68) == sys.maxsize
assert mod.to_ssize_t(12) == 12
raises(TypeError, mod.to_ssize_t, 2 ** 68, TypeError)
\ No newline at end of file
......@@ -40,7 +40,6 @@ def checkmodule(modname, translate_startup=True, ignore=(),
# force computation and record what we wrap
module = mod.Module(space, W_Root())
module.setup_after_space_initialization()
module.init(space)
modules.append(module)
for name in module.loaders:
if name in ignore:
......
......@@ -72,6 +72,8 @@ class FormatIterator(object):
self.operate(fmtdesc, repetitions)
break
else:
if c == '\0':
raise StructError("embedded null character")
raise StructError("bad char in struct format")
if not self._operate_is_specialized_:
if fmtdesc.alignment > 1:
......
......@@ -1076,28 +1076,6 @@ class TestInternalFunctions(object):
with pytest.raises(ZeroDivisionError):
rbigint.fromlong(x).int_divmod(0)
def test_int_divmod_mod_int_result(self):
for x in long_vals:
for y in int_vals + [-sys.maxint-1]:
if not y:
continue
for sx, sy in (1, 1), (1, -1), (-1, -1), (-1, 1):
sx *= x
sy *= y
if sy == sys.maxint + 1:
continue
f1 = rbigint.fromlong(sx)
div, rem = f1.int_divmod_mod_int_result(sy)
div1, rem1 = f1.divmod(rbigint.fromlong(sy))
_div, _rem = divmod(sx, sy)
print sx, sy, " | ", div.tolong(), rem.tolong()
assert div1.tolong() == _div
assert rem1.tolong() == _rem
assert div.tolong() == _div
assert rem.tolong() == _rem
with pytest.raises(ZeroDivisionError):
rbigint.fromlong(x).int_divmod_mod_int_result(0)
# testing Karatsuba stuff
def test__v_iadd(self):
f1 = bigint([lobj.MASK] * 10, 1)
......@@ -1575,7 +1553,7 @@ class TestHypothesis(object):
rx = rbigint.fromlong(x)
if not y:
with pytest.raises(ZeroDivisionError):
rx.int_mod(0)
rx.int_mod_int_result(0)
return
r1 = rx.int_mod_int_result(y)
r2 = x % y
......
......@@ -411,7 +411,8 @@ def getaddrinfo_pydotorg(i, result):
assert isinstance(lst, list)
found = False
for family, socktype, protocol, canonname, addr in lst:
if addr.get_host() in ('104.130.43.121', '23.253.135.79', '45.55.99.72'):
if addr.get_host() in ('138.197.63.241', '104.130.43.121',
'23.253.135.79', '45.55.99.72'):
found = True
elif family == AF_INET:
print 'pydotorg changed to', addr.get_host()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment