Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.6
Changeset: r96169:ff451dfc00d9
Date: 2019-02-26 15:57 +0100
http://bitbucket.org/pypy/pypy/changeset/ff451dfc00d9/
Log: merge default
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -19,11 +19,12 @@
except ImportError:
pass
else:
- if __version__[:3] < '3.6':
- s = settings(deadline=None)
- settings.register_profile('default', s)
- else:
+ try:
settings.register_profile('default', deadline=None)
+ except Exception:
+ import warnings
+ warnings.warn("Version of hypothesis too old, "
+ "cannot set the deadline to None")
settings.load_profile('default')
# PyPy's command line extra options (these are added
diff --git a/pypy/module/cpyext/dictobject.py b/pypy/module/cpyext/dictobject.py
--- a/pypy/module/cpyext/dictobject.py
+++ b/pypy/module/cpyext/dictobject.py
@@ -73,7 +73,7 @@
result_borrowed=True)
def PyDict_GetItem(space, w_dict, w_key):
if not isinstance(w_dict, W_DictMultiObject):
- raise PyErr_BadInternalCall(space)
+ return None
# NOTE: this works so far because all our dict strategies store
# *values* as full objects, which stay alive as long as the dict is
# alive and not modified. So we can return a borrowed ref.
@@ -83,14 +83,14 @@
@cpython_api([PyObject, PyObject, PyObject], rffi.INT_real, error=-1)
def PyDict_SetItem(space, w_dict, w_key, w_obj):
if not isinstance(w_dict, W_DictMultiObject):
- raise PyErr_BadInternalCall(space)
+ PyErr_BadInternalCall(space)
w_dict.setitem(w_key, w_obj)
return 0
@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1)
def PyDict_DelItem(space, w_dict, w_key):
if not isinstance(w_dict, W_DictMultiObject):
- raise PyErr_BadInternalCall(space)
+ PyErr_BadInternalCall(space)
w_dict.descr_delitem(space, w_key)
return 0
@@ -98,7 +98,7 @@
def PyDict_SetItemString(space, w_dict, key_ptr, w_obj):
w_key = space.newtext(rffi.charp2str(key_ptr))
if not isinstance(w_dict, W_DictMultiObject):
- raise PyErr_BadInternalCall(space)
+ PyErr_BadInternalCall(space)
w_dict.setitem(w_key, w_obj)
return 0
@@ -109,7 +109,7 @@
char*, rather than a PyObject*."""
w_key = space.newtext(rffi.charp2str(key))
if not isinstance(w_dict, W_DictMultiObject):
- raise PyErr_BadInternalCall(space)
+ return None
# NOTE: this works so far because all our dict strategies store
# *values* as full objects, which stay alive as long as the dict is
# alive and not modified. So we can return a borrowed ref.
diff --git a/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
b/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
--- a/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
@@ -1,12 +1,14 @@
import py
import sys
+import platform
from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
from rpython.rlib.rawstorage import misaligned_is_fine
def no_vector_backend():
- import platform
if platform.machine().startswith('x86'):
from rpython.jit.backend.x86.detect_feature import detect_sse4_2
+ if sys.maxsize < 2**31:
+ return True
return not detect_sse4_2()
if platform.machine().startswith('ppc'):
from rpython.jit.backend.ppc.detect_feature import detect_vsx
diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py
--- a/rpython/rlib/rutf8.py
+++ b/rpython/rlib/rutf8.py
@@ -153,6 +153,7 @@
"""Gives the position of the previous codepoint.
'pos' must not be zero.
"""
+ assert pos != 0
pos -= 1
if pos >= len(code): # for the case where pos - 1 == len(code):
assert pos >= 0
@@ -811,6 +812,18 @@
(0xF0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 )
assert False, "unreachable"
+class Utf8StringPosIterator(object):
+ def __init__(self, utf8s):
+ self.it = Utf8StringIterator(utf8s)
+
+ def __iter__(self):
+ return self
+
+ @always_inline
+ def next(self):
+ pos = self.it.get_pos()
+ return (self.it.next(), pos)
+
def decode_latin_1(s):
if len(s) == 0:
diff --git a/rpython/rlib/test/test_rsocket.py
b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -416,7 +416,7 @@
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'):
+ if addr.get_host() in ('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()
diff --git a/rpython/rlib/test/test_rutf8.py b/rpython/rlib/test/test_rutf8.py
--- a/rpython/rlib/test/test_rutf8.py
+++ b/rpython/rlib/test/test_rutf8.py
@@ -212,3 +212,16 @@
for c in u:
l.append(unichr(c))
assert list(arg) == l
+
+@given(strategies.text())
+def test_utf8_iterator_pos(arg):
+ utf8s = arg.encode('utf8')
+ u = rutf8.Utf8StringPosIterator(utf8s)
+ l = []
+ i = 0
+ for c, pos in u:
+ l.append(unichr(c))
+ assert c == rutf8.codepoint_at_pos(utf8s, pos)
+ assert pos == i
+ i = rutf8.next_codepoint_pos(utf8s, i)
+ assert list(arg) == l
diff --git a/rpython/translator/sandbox/test/test_sandlib.py
b/rpython/translator/sandbox/test/test_sandlib.py
--- a/rpython/translator/sandbox/test/test_sandlib.py
+++ b/rpython/translator/sandbox/test/test_sandlib.py
@@ -114,7 +114,7 @@
proc = SocketProc([exe])
output, error = proc.communicate("")
- assert output.startswith('HTTP/1.1 301 Moved Permanently')
+ assert output.startswith('HTTP/1.0 400 Bad request')
def test_oserror():
def entry_point(argv):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit