[pypy-commit] pypy py3.5: fix whatsnew
Author: Matti Picus Branch: py3.5 Changeset: r96007:1c6f81f3c5cf Date: 2019-02-13 23:21 +0200 http://bitbucket.org/pypy/pypy/changeset/1c6f81f3c5cf/ Log:fix whatsnew diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst --- a/pypy/doc/whatsnew-pypy3-head.rst +++ b/pypy/doc/whatsnew-pypy3-head.rst @@ -5,3 +5,6 @@ .. this is the revision after release-pypy3.5-v7.0 .. startrev: 9d2fa7c63b7c +.. branch: unicode-utf8-py3 + +Use utf8 instead of rpython-level unicode ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix reversed() on OrderedDict views
Author: Ronan Lamy Branch: py3.5 Changeset: r95730:4674aa2581e3 Date: 2019-01-26 20:12 + http://bitbucket.org/pypy/pypy/changeset/4674aa2581e3/ Log:Fix reversed() on OrderedDict views diff --git a/lib_pypy/_pypy_collections.py b/lib_pypy/_pypy_collections.py --- a/lib_pypy/_pypy_collections.py +++ b/lib_pypy/_pypy_collections.py @@ -137,14 +137,14 @@ class _OrderedDictKeysView(dict_keys): def __reversed__(self): -yield from reversed_dict(self._mapping) +yield from reversed_dict(self._dict) class _OrderedDictItemsView(dict_items): def __reversed__(self): -for key in reversed_dict(self._mapping): -yield (key, self._mapping[key]) +for key in reversed_dict(self._dict): +yield (key, self._dict[key]) class _OrderedDictValuesView(dict_values): def __reversed__(self): -for key in reversed_dict(self._mapping): -yield self._mapping[key] +for key in reversed_dict(self._dict): +yield self._dict[key] diff --git a/pypy/module/_collections/test/test_ordereddict.py b/pypy/module/_collections/test/test_ordereddict.py --- a/pypy/module/_collections/test/test_ordereddict.py +++ b/pypy/module/_collections/test/test_ordereddict.py @@ -22,3 +22,17 @@ assert d['x'] == 42 d.update({'y': 2}) assert d['y'] == 42 + +def test_reversed(self): +import sys +from _collections import OrderedDict + +pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] +od = OrderedDict(pairs) +if '__pypy__' in sys.builtin_module_names: +# dict ordering is wrong when testing interpreted on top of CPython +pairs = list(dict(od).items()) +assert list(reversed(od)) == [t[0] for t in reversed(pairs)] +assert list(reversed(od.keys())) == [t[0] for t in reversed(pairs)] +assert list(reversed(od.values())) == [t[1] for t in reversed(pairs)] +assert list(reversed(od.items())) == list(reversed(pairs)) diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -11,7 +11,7 @@ WrappedDefault, applevel, interp2app, unwrap_spec) from pypy.interpreter.mixedmodule import MixedModule from pypy.interpreter.signature import Signature -from pypy.interpreter.typedef import TypeDef +from pypy.interpreter.typedef import TypeDef, interp_attrproperty_w from pypy.interpreter.unicodehelper import decode_utf8 from pypy.objspace.std.util import negate @@ -1610,6 +1610,7 @@ __xor__ = interp2app(W_DictViewItemsObject.descr_xor), __rxor__ = interp2app(W_DictViewItemsObject.descr_rxor), isdisjoint = interp2app(W_DictViewItemsObject.descr_isdisjoint), +_dict = interp_attrproperty_w('w_dict', cls=W_DictViewItemsObject), ) W_DictViewKeysObject.typedef = TypeDef( @@ -1636,6 +1637,7 @@ __xor__ = interp2app(W_DictViewKeysObject.descr_xor), __rxor__ = interp2app(W_DictViewKeysObject.descr_rxor), isdisjoint = interp2app(W_DictViewKeysObject.descr_isdisjoint), +_dict = interp_attrproperty_w('w_dict', cls=W_DictViewKeysObject), ) W_DictViewValuesObject.typedef = TypeDef( @@ -1644,4 +1646,5 @@ __repr__ = interp2app(W_DictViewValuesObject.descr_repr), __len__ = interp2app(W_DictViewValuesObject.descr_len), __iter__ = interp2app(W_DictViewValuesObject.descr_iter), +_dict = interp_attrproperty_w('w_dict', cls=W_DictViewValuesObject), ) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix extra_tests/ctypes_tests/test_extra.py::test_truth_value()
Author: Ronan Lamy Branch: py3.5 Changeset: r95653:cd262738eee3 Date: 2019-01-16 20:27 + http://bitbucket.org/pypy/pypy/changeset/cd262738eee3/ Log:Fix extra_tests/ctypes_tests/test_extra.py::test_truth_value() diff --git a/lib_pypy/_ctypes/primitive.py b/lib_pypy/_ctypes/primitive.py --- a/lib_pypy/_ctypes/primitive.py +++ b/lib_pypy/_ctypes/primitive.py @@ -410,6 +410,6 @@ id(self)) def __bool__(self): -return self._buffer[0] not in (0, '\x00') +return self._buffer[0] not in (0, b'\x00') from _ctypes.function import CFuncPtr ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix merge and reduce diff
Author: Ronan Lamy Branch: py3.5 Changeset: r95648:59d7c3f4eb6d Date: 2019-01-16 16:26 + http://bitbucket.org/pypy/pypy/changeset/59d7c3f4eb6d/ Log:Fix merge and reduce diff diff --git a/pypy/module/__pypy__/test/test_builders.py b/pypy/module/__pypy__/test/test_builders.py --- a/pypy/module/__pypy__/test/test_builders.py +++ b/pypy/module/__pypy__/test/test_builders.py @@ -4,33 +4,32 @@ def test_simple(self): from __pypy__.builders import StringBuilder b = StringBuilder() -b.append("abc") -b.append("123") -b.append("1") +b.append(u"abc") +b.append(u"123") +b.append(u"1") s = b.build() -assert s == "abc1231" -assert type(s) is unicode +assert s == u"abc1231" assert b.build() == s -b.append("123") -assert b.build() == s + "123" +b.append(u"123") +assert b.build() == s + u"123" def test_preallocate(self): from __pypy__.builders import StringBuilder b = StringBuilder(10) -b.append("abc") -b.append("123") +b.append(u"abc") +b.append(u"123") s = b.build() -assert s == "abc123" +assert s == u"abc123" def test_append_slice(self): from __pypy__.builders import StringBuilder b = StringBuilder() -b.append_slice("abcdefgh", 2, 5) -raises(ValueError, b.append_slice, "1", 2, 1) +b.append_slice(u"abcdefgh", 2, 5) +raises(ValueError, b.append_slice, u"1", 2, 1) s = b.build() -assert s == "cde" -b.append_slice("abc", 1, 2) -assert b.build() == "cdeb" +assert s == u"cde" +b.append_slice(u"abc", 1, 2) +assert b.build() == u"cdeb" def test_stringbuilder(self): from __pypy__.builders import BytesBuilder ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix exception type
Author: Matti Picus Branch: py3.5 Changeset: r95521:528771eac6b5 Date: 2018-12-24 09:45 +0200 http://bitbucket.org/pypy/pypy/changeset/528771eac6b5/ Log:fix exception type diff --git a/pypy/objspace/std/smalllongobject.py b/pypy/objspace/std/smalllongobject.py --- a/pypy/objspace/std/smalllongobject.py +++ b/pypy/objspace/std/smalllongobject.py @@ -379,7 +379,7 @@ def _pow(space, iv, iw, iz): if iw < 0: if iz != 0: -raise oefmt(space.w_TypeError, +raise oefmt(space.w_ValueError, "pow() 2nd argument cannot be negative when 3rd " "argument specified") raise ValueError ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix some datetime.py test failures. Should this file move to lib_pypy?
Author: Matti Picus Branch: py3.5 Changeset: r95506:b5e988c47134 Date: 2018-12-17 11:40 +0200 http://bitbucket.org/pypy/pypy/changeset/b5e988c47134/ Log:fix some datetime.py test failures. Should this file move to lib_pypy? diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py --- a/lib-python/3/datetime.py +++ b/lib-python/3/datetime.py @@ -521,7 +521,11 @@ -self._microseconds) def __pos__(self): -return self +# for CPython compatibility, we cannot use +# our __class__ here, but need a real timedelta +return timedelta(self._days, + self._seconds, + self._microseconds) def __abs__(self): if self._days < 0: @@ -813,8 +817,7 @@ month = self._month if day is None: day = self._day -# PyPy fix: returns type(self)() instead of date() -return type(self)(year, month, day) +return date.__new__(type(self), year, month, day) # Comparisons of date objects with other. @@ -1289,8 +1292,8 @@ microsecond = self.microsecond if tzinfo is True: tzinfo = self.tzinfo -# PyPy fix: returns type(self)() instead of time() -return type(self)(hour, minute, second, microsecond, tzinfo) +return time.__new__(type(self), +hour, minute, second, microsecond, tzinfo) # Pickle support. @@ -1341,13 +1344,13 @@ hour, minute, second, microsecond) _check_tzinfo_arg(tzinfo) self = dateinterop.__new__(cls) -self._year = year -self._month = month -self._day = day -self._hour = hour -self._minute = minute -self._second = second -self._microsecond = microsecond +self._year = int(year) +self._month = int(month) +self._day = int(day) +self._hour = int(hour) +self._minute = int(minute) +self._second = int(second) +self._microsecond = int(microsecond) self._tzinfo = tzinfo self._hashcode = -1 return self @@ -1503,8 +1506,8 @@ if tzinfo is True: tzinfo = self.tzinfo # PyPy fix: returns type(self)() instead of datetime() -return type(self)(year, month, day, hour, minute, second, microsecond, -tzinfo) +return datetime.__new__(type(self), year, month, day, hour, minute, +second, microsecond, tzinfo) def astimezone(self, tz=None): if tz is None: @@ -1768,7 +1771,10 @@ if myoff == otoff: return base if myoff is None or otoff is None: -raise TypeError("cannot mix naive and timezone-aware time") +# The CPython _datetimemodule.c error message and the +# datetime.py one are different +raise TypeError("can't subtract offset-naive and " +"offset-aware datetimes") return base + otoff - myoff def __hash__(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix import on python3
Author: Matti Picus Branch: py3.5 Changeset: r95368:11d6f6bd6dc8 Date: 2018-11-26 12:16 -0800 http://bitbucket.org/pypy/pypy/changeset/11d6f6bd6dc8/ Log:fix import on python3 diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py --- a/lib_pypy/cffi/recompiler.py +++ b/lib_pypy/cffi/recompiler.py @@ -1542,7 +1542,7 @@ def _verify(ffi, module_name, preamble, *args, **kwds): # FOR TESTS ONLY -from testing.udir import udir +from .testing.udir import udir import imp assert module_name not in sys.modules, "module name conflict: %r" % ( module_name,) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix import
Author: Ronan Lamy Branch: py3.5 Changeset: r95355:773010593365 Date: 2018-11-22 00:42 + http://bitbucket.org/pypy/pypy/changeset/773010593365/ Log:fix import diff --git a/extra_tests/test_decimal.py b/extra_tests/test_decimal.py --- a/extra_tests/test_decimal.py +++ b/extra_tests/test_decimal.py @@ -4,7 +4,7 @@ import pickle import sys -from support import import_fresh_module +from .support import import_fresh_module C = import_fresh_module('decimal', fresh=['_decimal']) P = import_fresh_module('decimal', blocked=['_decimal']) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix typo (using unicode-utf8 syntax too early)
Author: Matti Picus Branch: py3.5 Changeset: r95334:064564894563 Date: 2018-11-18 10:59 -0800 http://bitbucket.org/pypy/pypy/changeset/064564894563/ Log:fix typo (using unicode-utf8 syntax too early) diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -533,7 +533,7 @@ if space.isinstance_w(w_obj, space.w_bytes): s = space.bytes_w(w_obj) if not s: -return space.newtext('', 0) +return space.newtext('') elif space.isinstance_w(w_obj, space.w_unicode): raise oefmt(space.w_TypeError, "decoding str is not supported") elif space.isinstance_w(w_obj, space.w_bytearray): # Python 2.x specific ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge, PyUnicode_FromEncodedObject already tested in test_decode
Author: Matti Picus Branch: py3.5 Changeset: r95303:861c793cead8 Date: 2018-11-12 13:39 -0800 http://bitbucket.org/pypy/pypy/changeset/861c793cead8/ Log:fix merge, PyUnicode_FromEncodedObject already tested in test_decode diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -684,8 +684,6 @@ with raises_w(space, TypeError): PyUnicode_FromEncodedObject( space, space.wrap(u_text), null_charp, None) -assert space.unicode_w(PyUnicode_FromEncodedObject( -space, space.wrap(s_text), null_charp, None)) == u_text rffi.free_charp(b_text) def test_mbcs(self, space): diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -490,11 +490,12 @@ encoding, errors) def _pyunicode_decode(space, s, encoding, errors): -if not encoding: -# This tracks CPython 2.7, in CPython 3.4 'utf-8' is hardcoded instead -encoding = PyUnicode_GetDefaultEncoding(space) +if encoding: +w_encoding = space.newtext(rffi.charp2str(encoding)) +else: +# python 3.4 changed to this from defaultencoding +w_encoding = space.newtext('utf-8') w_str = space.newbytes(s) -w_encoding = space.newtext(rffi.charp2str(encoding)) if errors: w_errors = space.newtext(rffi.charp2str(errors)) else: @@ -530,10 +531,10 @@ All other objects, including Unicode objects, cause a TypeError to be set.""" if space.isinstance_w(w_obj, space.w_unicode): -raise oefmt(space.w_TypeError, "decoding Unicode is not supported") +raise oefmt(space.w_TypeError, "decoding str is not supported") if space.isinstance_w(w_obj, space.w_bytearray): # Python 2.x specific raise oefmt(space.w_TypeError, "decoding bytearray is not supported") -s = space.bufferstr_w(w_obj) +s = space.bytes_w(w_obj) return _pyunicode_decode(space, s, encoding, errors) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test for py3
Author: Matti Picus Branch: py3.5 Changeset: r95039:553bafd3b1ec Date: 2018-08-29 09:47 +0200 http://bitbucket.org/pypy/pypy/changeset/553bafd3b1ec/ Log:fix test for py3 diff --git a/pypy/module/cpyext/test0/test_floatobject.py b/pypy/module/cpyext/test0/test_floatobject.py --- a/pypy/module/cpyext/test0/test_floatobject.py +++ b/pypy/module/cpyext/test0/test_floatobject.py @@ -116,18 +116,18 @@ # floating-point conversion issues (and to avoid having to # conditionalize on compiler support for long double) for const_name, const_strval in [ -('Py_MATH_PIl', "3.1415926535897932384626433832795029L"), -('Py_MATH_PI', "3.14159265358979323846"), -('Py_MATH_El', "2.7182818284590452353602874713526625L"), -('Py_MATH_E', "2.7182818284590452354"), -('Py_MATH_TAU', "6.2831853071795864769252867665590057683943L"), +('Py_MATH_PIl', b"3.1415926535897932384626433832795029L"), +('Py_MATH_PI', b"3.14159265358979323846"), +('Py_MATH_El', b"2.7182818284590452353602874713526625L"), +('Py_MATH_E', b"2.7182818284590452354"), +('Py_MATH_TAU', b"6.2831853071795864769252867665590057683943L"), ]: module = self.import_extension('foo_%s' % const_name, [ ("test", "METH_NOARGS", """ #define xstr(s) str(s) #define str(s) #s - return PyString_FromString(xstr(%s));""" % const_name) + return PyBytes_FromString(xstr(%s));""" % const_name) ]) assert module.test() == const_strval ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix bad automatic merge
Author: Matti Picus Branch: py3.5 Changeset: r95038:33943b0827fd Date: 2018-08-29 08:21 +0200 http://bitbucket.org/pypy/pypy/changeset/33943b0827fd/ Log:fix bad automatic merge diff --git a/pypy/module/cpyext/test0/test_abstract.py b/pypy/module/cpyext/test0/test_abstract.py deleted file mode 100644 --- a/pypy/module/cpyext/test0/test_abstract.py +++ /dev/null @@ -1,130 +0,0 @@ -from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase -import pytest - -class AppTestBufferProtocol(AppTestCpythonExtensionBase): -"""Tests for the old buffer protocol.""" - -def w_get_buffer_support(self): -return self.import_extension('buffer_support', [ -("charbuffer_as_string", "METH_O", - """ - char *ptr; - Py_ssize_t size; - if (PyObject_AsCharBuffer(args, (const char **), ) < 0) - return NULL; - return PyString_FromStringAndSize(ptr, size); - """), -("check_readbuffer", "METH_O", - """ - return PyBool_FromLong(PyObject_CheckReadBuffer(args)); - """), -("readbuffer_as_string", "METH_O", - """ - const void *ptr; - Py_ssize_t size; - if (PyObject_AsReadBuffer(args, , ) < 0) - return NULL; - return PyString_FromStringAndSize((char*)ptr, size); - """), -("writebuffer_as_string", "METH_O", - """ - void *ptr; - Py_ssize_t size; - if (PyObject_AsWriteBuffer(args, , ) < 0) - return NULL; - return PyString_FromStringAndSize((char*)ptr, size); - """), -("zero_out_writebuffer", "METH_O", - """ - void *ptr; - Py_ssize_t size; - Py_ssize_t i; - if (PyObject_AsWriteBuffer(args, , ) < 0) - return NULL; - for (i = 0; i < size; i++) { - ((char*)ptr)[i] = 0; - } - Py_RETURN_NONE; - """), -]) - -def test_string(self): -buffer_support = self.get_buffer_support() - -s = 'a\0x' - -assert buffer_support.check_readbuffer(s) -assert s == buffer_support.readbuffer_as_string(s) -assert raises(TypeError, buffer_support.writebuffer_as_string, s) -assert s == buffer_support.charbuffer_as_string(s) - -def test_buffer(self): -buffer_support = self.get_buffer_support() - -s = 'a\0x' -buf = buffer(s) - -assert buffer_support.check_readbuffer(buf) -assert s == buffer_support.readbuffer_as_string(buf) -assert raises(TypeError, buffer_support.writebuffer_as_string, buf) -assert s == buffer_support.charbuffer_as_string(buf) - -def test_mmap(self): -import mmap -buffer_support = self.get_buffer_support() - -s = 'a\0x' -mm = mmap.mmap(-1, 3) -mm[:] = s - -assert buffer_support.check_readbuffer(mm) -assert s == buffer_support.readbuffer_as_string(mm) -assert s == buffer_support.writebuffer_as_string(mm) -assert s == buffer_support.charbuffer_as_string(mm) - -s = '\0' * 3 -buffer_support.zero_out_writebuffer(mm) -assert s == ''.join(mm) -assert s == buffer_support.readbuffer_as_string(mm) -assert s == buffer_support.writebuffer_as_string(mm) -assert s == buffer_support.charbuffer_as_string(mm) - -s = '\0' * 3 -ro_mm = mmap.mmap(-1, 3, access=mmap.ACCESS_READ) -assert buffer_support.check_readbuffer(ro_mm) -assert s == buffer_support.readbuffer_as_string(ro_mm) -assert raises(TypeError, buffer_support.writebuffer_as_string, ro_mm) -assert s == buffer_support.charbuffer_as_string(ro_mm) - -def test_array(self): -import array -buffer_support = self.get_buffer_support() - -s = 'a\0x' -a = array.array('B', [5, 0, 10]) - -buffer_support.zero_out_writebuffer(a) -assert list(a) == [0, 0, 0] - -def test_nonbuffer(self): -# e.g. int -buffer_support = self.get_buffer_support() - -assert not buffer_support.check_readbuffer(42) -assert raises(TypeError, buffer_support.readbuffer_as_string, 42) -assert raises(TypeError, buffer_support.writebuffer_as_string, 42) -assert raises(TypeError, buffer_support.charbuffer_as_string, 42) - -def test_user_class(self): -class MyBuf(str): -pass -s = 'a\0x' -buf = MyBuf(s) -buffer_support = self.get_buffer_support() - -assert buffer_support.check_readbuffer(buf) -assert s == buffer_support.readbuffer_as_string(buf) -assert raises(TypeError,
[pypy-commit] pypy py3.5: Fix for cpyext test_translate when run after test_buffer. Not sure why
Author: Armin Rigo Branch: py3.5 Changeset: r95032:06709625320e Date: 2018-08-27 22:23 +0200 http://bitbucket.org/pypy/pypy/changeset/06709625320e/ Log:Fix for cpyext test_translate when run after test_buffer. Not sure why but it must be something like the thread support in the embedding mode of cffi. diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -200,6 +200,10 @@ default=False, requires=[("objspace.usemodules.cpyext", False)]), +BoolOption("disable_entrypoints_in_cffi", + "Disable only cffi's embedding mode.", + default=False), + BoolOption("fstrings", "if you are really convinced that f-strings are a security " "issue, you can disable them here", diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -71,7 +71,8 @@ def __init__(self, space, *args): MixedModule.__init__(self, space, *args) # -if not space.config.objspace.disable_entrypoints: +if (not space.config.objspace.disable_entrypoints and +not space.config.objspace.disable_entrypoints_in_cffi): # import 'embedding', which has the side-effect of registering # the 'pypy_init_embedded_cffi_module' entry point from pypy.module._cffi_backend import embedding diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py --- a/pypy/module/cpyext/test/test_cpyext.py +++ b/pypy/module/cpyext/test/test_cpyext.py @@ -136,10 +136,11 @@ class LeakCheckingTest(object): """Base class for all cpyext tests.""" -spaceconfig = dict(usemodules=['cpyext', 'thread', 'struct', 'array', +spaceconfig = {"usemodules" : ['cpyext', 'thread', 'struct', 'array', 'itertools', 'time', 'binascii', 'mmap', '_cffi_backend', - ]) + ], + "objspace.disable_entrypoints_in_cffi": True} @classmethod def preload_builtins(cls, space): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test for python3 api
Author: Matti Picus Branch: py3.5 Changeset: r95006:0ebfd8239706 Date: 2018-08-17 02:50 +0300 http://bitbucket.org/pypy/pypy/changeset/0ebfd8239706/ Log:fix test for python3 api diff --git a/pypy/module/cpyext/test/test_object.py b/pypy/module/cpyext/test/test_object.py --- a/pypy/module/cpyext/test/test_object.py +++ b/pypy/module/cpyext/test/test_object.py @@ -415,7 +415,7 @@ module = self.import_extension('foo', [ ("enter", "METH_O", """ -return PyInt_FromLong(Py_ReprEnter(args)); +return PyLong_FromLong(Py_ReprEnter(args)); """), ("leave", "METH_O", """ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix print statement
Author: Matti Picus Branch: py3.5 Changeset: r95002:d6a8f43fadd2 Date: 2018-08-13 09:37 -0700 http://bitbucket.org/pypy/pypy/changeset/d6a8f43fadd2/ Log:fix print statement diff --git a/pypy/module/cpyext/test/test_datetime.py b/pypy/module/cpyext/test/test_datetime.py --- a/pypy/module/cpyext/test/test_datetime.py +++ b/pypy/module/cpyext/test/test_datetime.py @@ -308,7 +308,7 @@ # copied from datetime documentation class GMT1(tzinfo): def __del__(self): -print 'deleting GMT1' +print('deleting GMT1') def utcoffset(self, dt): return timedelta(hours=1) + self.dst(dt) def dst(self, dt): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix thread => _thread
Author: Armin Rigo Branch: py3.5 Changeset: r94981:103f347f34e8 Date: 2018-08-09 08:39 +0200 http://bitbucket.org/pypy/pypy/changeset/103f347f34e8/ Log:Fix thread => _thread diff --git a/lib_pypy/grp.py b/lib_pypy/grp.py --- a/lib_pypy/grp.py +++ b/lib_pypy/grp.py @@ -5,8 +5,8 @@ import os from _pwdgrp_cffi import ffi, lib import _structseq -import thread -_lock = thread.allocate_lock() +import _thread +_lock = _thread.allocate_lock() try: from __pypy__ import builtinify except ImportError: builtinify = lambda f: f diff --git a/lib_pypy/pwd.py b/lib_pypy/pwd.py --- a/lib_pypy/pwd.py +++ b/lib_pypy/pwd.py @@ -12,8 +12,8 @@ from _pwdgrp_cffi import ffi, lib import _structseq -import thread -_lock = thread.allocate_lock() +import _thread +_lock = _thread.allocate_lock() try: from __pypy__ import builtinify except ImportError: builtinify = lambda f: f ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix the tests in test_pyframe that fail in combination with other files
Author: Carl Friedrich Bolz-Tereick Branch: py3.5 Changeset: r94921:dfda715a5495 Date: 2018-07-28 21:31 +0200 http://bitbucket.org/pypy/pypy/changeset/dfda715a5495/ Log:fix the tests in test_pyframe that fail in combination with other files diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py --- a/pypy/interpreter/test/test_pyframe.py +++ b/pypy/interpreter/test/test_pyframe.py @@ -153,6 +153,8 @@ r""" seen = [] def tracer(f, event, *args): +if f.f_code.co_name == "decode": +return tracer seen.append((event, f.f_lineno)) if len(seen) == 5: f.f_lineno = 1 # bug shown only when setting lineno to 1 @@ -297,7 +299,8 @@ l = [] def trace(a,b,c): -l.append((a,b,c)) +if a.f_code.co_name != "decode": +l.append((a,b,c)) def f(): h = _testing.Hidden() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test_executioncontext flakiness
Author: Carl Friedrich Bolz-Tereick Branch: py3.5 Changeset: r94920:0370bd9179ff Date: 2018-07-28 16:03 +0200 http://bitbucket.org/pypy/pypy/changeset/0370bd9179ff/ Log:fix test_executioncontext flakiness when run in some combinations with other test files that set the file system encoding, space.appexec causes a call to "encode" internally, which produces extra C call events. Just ignore those. diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py --- a/pypy/interpreter/test/test_executioncontext.py +++ b/pypy/interpreter/test/test_executioncontext.py @@ -149,7 +149,7 @@ pass """) space.getexecutioncontext().setllprofile(None, None) -assert l == ['call', 'return', 'call', 'return'] +assert l[-4:] == ['call', 'return', 'call', 'return'] def test_llprofile_c_call(self): from pypy.interpreter.function import Function, Method @@ -173,15 +173,15 @@ return """ % snippet) space.getexecutioncontext().setllprofile(None, None) -assert l == ['call', 'return', 'call', 'c_call', 'c_return', 'return'] -if isinstance(seen[0], Method): -w_class = space.type(seen[0].w_instance) +assert l[-6:] == ['call', 'return', 'call', 'c_call', 'c_return', 'return'] +if isinstance(seen[-1], Method): +w_class = space.type(seen[-1].w_instance) found = 'method %s of %s' % ( -seen[0].w_function.name, +seen[-1].w_function.name, w_class.getname(space).encode('utf-8')) else: -assert isinstance(seen[0], Function) -found = 'builtin %s' % seen[0].name +assert isinstance(seen[-1], Function) +found = 'builtin %s' % seen[-1].name assert found == expected_c_call check_snippet('l = []; l.append(42)', 'method append of list') @@ -210,7 +210,7 @@ return """ % snippet) space.getexecutioncontext().setllprofile(None, None) -assert l == ['call', 'return', 'call', 'c_call', 'c_exception', 'return'] +assert l[-6:] == ['call', 'return', 'call', 'c_call', 'c_exception', 'return'] check_snippet('d = {}; d.__getitem__(42)') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix a test that
Author: Carl Friedrich Bolz-Tereick Branch: py3.5 Changeset: r94919:09d5a78a60b4 Date: 2018-07-28 15:28 +0200 http://bitbucket.org/pypy/pypy/changeset/09d5a78a60b4/ Log:fix a test that diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -470,7 +470,7 @@ def test_cmd_co_name(self): child = self.spawn(['-c', -'import sys; print sys._getframe(0).f_code.co_name']) +'import sys; print(sys._getframe(0).f_code.co_name)']) child.expect('') def test_ignore_python_inspect(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix annotation bug reported by hubo on pypy-dev
Author: Carl Friedrich Bolz-Tereick Branch: py3.5 Changeset: r94913:179c172169f1 Date: 2018-07-28 14:06 +0200 http://bitbucket.org/pypy/pypy/changeset/179c172169f1/ Log:fix annotation bug reported by hubo on pypy-dev diff --git a/pypy/interpreter/astcompiler/symtable.py b/pypy/interpreter/astcompiler/symtable.py --- a/pypy/interpreter/astcompiler/symtable.py +++ b/pypy/interpreter/astcompiler/symtable.py @@ -622,6 +622,10 @@ assert isinstance(args, ast.arguments) if args.args: self._visit_arg_annotations(args.args) +if args.vararg: +self._visit_arg_annotation(args.vararg) +if args.kwarg: +self._visit_arg_annotation(args.kwarg) if args.kwonlyargs: self._visit_arg_annotations(args.kwonlyargs) if func.returns: @@ -630,8 +634,11 @@ def _visit_arg_annotations(self, args): for arg in args: assert isinstance(arg, ast.arg) -if arg.annotation: -arg.annotation.walkabout(self) +self._visit_arg_annotation(arg) + +def _visit_arg_annotation(self, arg): +if arg.annotation: +arg.annotation.walkabout(self) def visit_Name(self, name): if name.ctx == ast.Load: diff --git a/pypy/interpreter/test/test_syntax.py b/pypy/interpreter/test/test_syntax.py --- a/pypy/interpreter/test/test_syntax.py +++ b/pypy/interpreter/test/test_syntax.py @@ -691,6 +691,16 @@ "bye" : 5, "kw" : 6, "return" : 42} """ +def test_bug_annotations_lambda(self): +""" +# those used to crash +def broken(*a: lambda x: None): +pass + +def broken(**a: lambda x: None): +pass +""" + class AppTestSyntaxError: def test_tokenizer_error_location(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix py3.5 translation of the _cppyy module
Author: Armin Rigo Branch: py3.5 Changeset: r94820:bc77e35508e9 Date: 2018-07-06 20:12 +0200 http://bitbucket.org/pypy/pypy/changeset/bc77e35508e9/ Log:Fix py3.5 translation of the _cppyy module diff --git a/pypy/module/_cppyy/interp_cppyy.py b/pypy/module/_cppyy/interp_cppyy.py --- a/pypy/module/_cppyy/interp_cppyy.py +++ b/pypy/module/_cppyy/interp_cppyy.py @@ -471,11 +471,8 @@ __new__ = interp2app(MethodWithProps.descr_method__new__.im_func), __call__ = interp2app(MethodWithProps.descr_method_call), __get__ = interp2app(MethodWithProps.descr_method_get), -im_func = interp_attrproperty_w('w_function', cls=MethodWithProps), __func__ = interp_attrproperty_w('w_function', cls=MethodWithProps), -im_self = interp_attrproperty_w('w_instance', cls=MethodWithProps), __self__ = interp_attrproperty_w('w_instance', cls=MethodWithProps), -im_class = interp_attrproperty_w('w_class', cls=MethodWithProps), __getattribute__ = interp2app(MethodWithProps.descr_method_getattribute), __eq__ = interp2app(MethodWithProps.descr_method_eq), __ne__ = descr_generic_ne, @@ -510,9 +507,9 @@ not space.is_w(w_obj, space.w_None) or space.is_w(w_cls, space.type(space.w_None))) if asking_for_bound: -return MethodWithProps(space, self, w_obj, w_cls) +return MethodWithProps(space, self, w_obj) else: -return MethodWithProps(space, self, None, w_cls) +return self # unbound methods don't exist in Python 3 @unwrap_spec(args_w='args_w') def call_args(self, args_w): @@ -600,7 +597,7 @@ def getname(self, space): # for the benefit of Method/instancemethod -return capi.c_method_name(space, self.functions[0].cppmethod) +return capi.c_method_name(space, self.functions[0].cppmethod).decode('latin-1') def __repr__(self): return "W_CPPOverload(%s)" % [f.prototype() for f in self.functions] @@ -626,7 +623,7 @@ # onto a class and w_this should be set cppinstance = self.space.interp_w(W_CPPInstance, w_obj) if cppinstance.clsdecl.handle != self.scope.handle: - return MethodWithProps(self.space, self, w_obj, w_cls)# bound + return MethodWithProps(self.space, self, w_obj)# bound return self # unbound @unwrap_spec(args_w='args_w') @@ -835,7 +832,7 @@ return self.getitem_impl(self.name, args_w) def getname(self, space): -return self.name +return self.name.decode('latin-1') def __repr__(self): return "W_CPPTemplateOverload(%s)" % [f.prototype() for f in self.functions] @@ -893,7 +890,7 @@ return self.getitem_impl(self.name, args_w) def getname(self, space): -return self.name +return self.name.decode('latin-1') def __repr__(self): return "W_CPPTemplateStaticOverload(%s)" % [f.prototype() for f in self.functions] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix for issue #2837 in pypy3
Author: Armin Rigo Branch: py3.5 Changeset: r94807:a74f33cd9f8f Date: 2018-07-05 17:29 +0200 http://bitbucket.org/pypy/pypy/changeset/a74f33cd9f8f/ Log:Fix for issue #2837 in pypy3 diff --git a/lib_pypy/pyrepl/simple_interact.py b/lib_pypy/pyrepl/simple_interact.py --- a/lib_pypy/pyrepl/simple_interact.py +++ b/lib_pypy/pyrepl/simple_interact.py @@ -81,3 +81,8 @@ except MemoryError: console.write("\nMemoryError\n") console.resetbuffer() +finally: +try: +sys.stdout.flush() +except: +pass ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix _sysconfigdata on MacOS
Author: Andrew Stepanov Branch: py3.5 Changeset: r94721:87fe9e08fe50 Date: 2018-06-02 16:28 +0300 http://bitbucket.org/pypy/pypy/changeset/87fe9e08fe50/ Log:Fix _sysconfigdata on MacOS diff --git a/lib_pypy/_sysconfigdata.py b/lib_pypy/_sysconfigdata.py --- a/lib_pypy/_sysconfigdata.py +++ b/lib_pypy/_sysconfigdata.py @@ -24,6 +24,15 @@ 'VERSION': sys.version[:3] } +if find_executable("gcc"): +build_time_vars.update({ +"CC": "gcc -pthread", +"GNULD": "yes", +"LDSHARED": "gcc -pthread -shared", +}) +if find_executable("g++"): +build_time_vars["CXX"] = "g++ -pthread" + if sys.platform[:6] == "darwin": import platform if platform.machine() == 'i386': @@ -36,12 +45,6 @@ arch = platform.machine() build_time_vars['LDSHARED'] += ' -undefined dynamic_lookup' build_time_vars['CC'] += ' -arch %s' % (arch,) +if "CXX" in build_time_vars: +build_time_vars['CXX'] += ' -arch %s' % (arch,) -if find_executable("gcc"): -build_time_vars.update({ -"CC": "gcc -pthread", -"GNULD": "yes", -"LDSHARED": "gcc -pthread -shared", -}) -if find_executable("g++"): -build_time_vars["CXX"] = "g++ -pthread" ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix NameError from last commit.
Author: Manuel Jacob Branch: py3.5 Changeset: r94714:1807915e1ede Date: 2018-05-31 01:01 +0200 http://bitbucket.org/pypy/pypy/changeset/1807915e1ede/ Log:Fix NameError from last commit. diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -1447,7 +1447,7 @@ for i in range(itemcount, 0, -1): w_item = frame.peekvalue(i-1) w_sum.extend(w_item) -self.popalues(itemcount) +frame.popvalues(itemcount) return w_sum @jit.unroll_safe ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix issue #2838: don't swallow exceptions in BUILD_SET_UNPACK
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94691:26a7e1a30293 Date: 2018-05-27 17:27 +0200 http://bitbucket.org/pypy/pypy/changeset/26a7e1a30293/ Log:fix issue #2838: don't swallow exceptions in BUILD_SET_UNPACK (the bytecode was quite badly broken in other ways too: the JIT would unroll the set generation completely} diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -1433,21 +1433,12 @@ @jit.unroll_safe def BUILD_SET_UNPACK(self, itemcount, next_instr): space = self.space -w_sum = space.newset() +w_set = space.newset() for i in range(itemcount, 0, -1): w_item = self.peekvalue(i-1) -# cannot use w_sum.update, w_item might not be a set -iterator = space.iter(w_item) -while True: -try: -w_value = space.next(iterator) -except OperationError: -break -w_sum.add(w_value) -while itemcount != 0: -self.popvalue() -itemcount -= 1 -self.pushvalue(w_sum) +space.call_method(w_set, "update", w_item) +self.popvalues(itemcount) +self.pushvalue(w_set) @jit.unroll_safe def list_unpack_helper(frame, itemcount): diff --git a/pypy/interpreter/test/test_interpreter.py b/pypy/interpreter/test/test_interpreter.py --- a/pypy/interpreter/test/test_interpreter.py +++ b/pypy/interpreter/test/test_interpreter.py @@ -265,7 +265,7 @@ return a, b, c, d """ assert self.codetest(code, "f", [1, 2], {"d" : 4, "c" : 3}) == (1, 2, 3, 4) - + def test_build_set_unpack(self): code = """ def f(): return {*range(4), 4, *(5, 6, 7)} @@ -274,13 +274,28 @@ res = self.codetest(code, "f", []) l_res = space.call_function(space.w_list, res) assert space.unwrap(l_res) == [0, 1, 2, 3, 4, 5, 6, 7] - + +def test_build_set_unpack_exception(self): +code = """ if 1: +def g(): +yield 1 +yield 2 +raise TypeError +def f(): +try: +{*g(), 1, 2} +except TypeError: +return True +return False +""" +assert self.codetest(code, "f", []) + def test_build_tuple_unpack(self): code = """ def f(): return (*range(4), 4) """ assert self.codetest(code, "f", []) == (0, 1, 2, 3, 4) - + def test_build_list_unpack(self): code = """ def f(): return [*range(4), 4] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test
Author: Armin RigoBranch: py3.5 Changeset: r94658:33ccfe808125 Date: 2018-05-23 19:33 +0200 http://bitbucket.org/pypy/pypy/changeset/33ccfe808125/ Log:Fix test diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py --- a/pypy/objspace/std/test/test_dictmultiobject.py +++ b/pypy/objspace/std/test/test_dictmultiobject.py @@ -290,7 +290,7 @@ import __pypy__ def kw(**d): return d for d in [{}, {1: 2, 3: 4, 5: 6}, {"a": 5, "b": 2, "c": 6}, kw(a=1, b=2)]: -assert list(__pypy__.reversed_dict(d)) == list(d.keys()[::-1]) +assert list(__pypy__.reversed_dict(d)) == list(d.keys())[::-1] raises(TypeError, __pypy__.reversed_dict, 42) def test_reversed_dict_runtimeerror(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix more raises/skip imports
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94597:c697fd791c27 Date: 2018-05-15 21:58 +0200 http://bitbucket.org/pypy/pypy/changeset/c697fd791c27/ Log:fix more raises/skip imports diff --git a/pypy/objspace/std/test/test_iterobject.py b/pypy/objspace/std/test/test_iterobject.py --- a/pypy/objspace/std/test/test_iterobject.py +++ b/pypy/objspace/std/test/test_iterobject.py @@ -1,3 +1,4 @@ +import pytest from pypy.objspace.std.iterobject import W_SeqIterObject from pypy.interpreter.error import OperationError @@ -11,8 +12,8 @@ self.body0(w_iter) def body0(self, w_iter): -raises(OperationError, self.space.next, w_iter) -raises(OperationError, self.space.next, w_iter) +pytest.raises(OperationError, self.space.next, w_iter) +pytest.raises(OperationError, self.space.next, w_iter) def test_iter(self): w = self.space.wrap diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py --- a/pypy/objspace/std/test/test_listobject.py +++ b/pypy/objspace/std/test/test_listobject.py @@ -120,8 +120,8 @@ assert self.space.eq_w(self.space.next(w_iter), w(5)) assert self.space.eq_w(self.space.next(w_iter), w(3)) assert self.space.eq_w(self.space.next(w_iter), w(99)) -raises(OperationError, self.space.next, w_iter) -raises(OperationError, self.space.next, w_iter) +py.test.raises(OperationError, self.space.next, w_iter) +py.test.raises(OperationError, self.space.next, w_iter) def test_contains(self): w = self.space.wrap diff --git a/pypy/objspace/std/test/test_setstrategies.py b/pypy/objspace/std/test/test_setstrategies.py --- a/pypy/objspace/std/test/test_setstrategies.py +++ b/pypy/objspace/std/test/test_setstrategies.py @@ -1,3 +1,4 @@ +import pytest from pypy.objspace.std.setobject import W_SetObject from pypy.objspace.std.setobject import ( BytesIteratorImplementation, BytesSetStrategy, EmptySetStrategy, @@ -58,7 +59,7 @@ s1 = W_SetObject(self.space, self.wrapped([1,2,3,4,5])) s2 = W_SetObject(self.space, self.wrapped([4,5, "six", "seven"])) s3 = s1.intersect(s2) -skip("for now intersection with ObjectStrategy always results in another ObjectStrategy") +pytest.skip("for now intersection with ObjectStrategy always results in another ObjectStrategy") assert s3.strategy is self.space.fromcache(IntegerSetStrategy) def test_clear(self): @@ -93,7 +94,7 @@ s1 = W_SetObject(self.space, self.wrapped([1,2,3,4,5])) s1.descr_discard(self.space, self.space.wrap("five")) -skip("currently not supported") +pytest.skip("currently not supported") assert s1.strategy is self.space.fromcache(IntegerSetStrategy) set_discard__Set_ANY(self.space, s1, self.space.wrap(FakeInt(5))) @@ -112,7 +113,7 @@ s1 = W_SetObject(self.space, self.wrapped([1,2,3,4,5])) assert not s1.has_key(self.space.wrap("five")) -skip("currently not supported") +pytest.skip("currently not supported") assert s1.strategy is self.space.fromcache(IntegerSetStrategy) assert s1.has_key(self.space.wrap(FakeInt(2))) diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py --- a/pypy/objspace/std/test/test_tupleobject.py +++ b/pypy/objspace/std/test/test_tupleobject.py @@ -1,3 +1,4 @@ +import pytest from pypy.interpreter.error import OperationError from pypy.objspace.std.tupleobject import W_TupleObject @@ -42,8 +43,8 @@ assert self.space.eq_w(self.space.next(w_iter), w(5)) assert self.space.eq_w(self.space.next(w_iter), w(3)) assert self.space.eq_w(self.space.next(w_iter), w(99)) -raises(OperationError, self.space.next, w_iter) -raises(OperationError, self.space.next, w_iter) +pytest.raises(OperationError, self.space.next, w_iter) +pytest.raises(OperationError, self.space.next, w_iter) def test_contains(self): w = self.space.wrap ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix raises
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94589:5cf998ecbe9b Date: 2018-05-14 23:29 +0200 http://bitbucket.org/pypy/pypy/changeset/5cf998ecbe9b/ Log:fix raises diff --git a/pypy/interpreter/astcompiler/test/test_validate.py b/pypy/interpreter/astcompiler/test/test_validate.py --- a/pypy/interpreter/astcompiler/test/test_validate.py +++ b/pypy/interpreter/astcompiler/test/test_validate.py @@ -1,4 +1,5 @@ import os +from pytest import raises from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.astcompiler import ast ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix skips
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94586:e5f1a7f119f2 Date: 2018-05-14 23:25 +0200 http://bitbucket.org/pypy/pypy/changeset/e5f1a7f119f2/ Log:fix skips diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -375,7 +375,7 @@ child.expect('>>>') def test_atexit(self): -skip("Python3 atexit is a builtin module") +py.test.skip("Python3 atexit is a builtin module") child = self.spawn([]) child.expect('>>> ') child.sendline('def f(): print("foobye")') @@ -525,9 +525,9 @@ def test_options_i_m(self, monkeypatch): if sys.platform == "win32": -skip("close_fds is not supported on Windows platforms") +py.test.skip("close_fds is not supported on Windows platforms") if not hasattr(runpy, '_run_module_as_main'): -skip("requires CPython >= 2.6") +py.test.skip("requires CPython >= 2.6") p = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'mymodule.py') p = os.path.abspath(p) monkeypatch.chdir(os.path.dirname(app_main)) @@ -557,7 +557,7 @@ def test_options_u_i(self): if sys.platform == "win32": -skip("close_fds is not supported on Windows platforms") +py.test.skip("close_fds is not supported on Windows platforms") import subprocess, select, os pipe = subprocess.Popen([get_python3(), app_main, "-u", "-i"], stdout=subprocess.PIPE, @@ -614,7 +614,7 @@ del os.environ['PYTHONINSPECT_'] def test_stdout_flushes_before_stdin_blocks(self): -skip("Python3 does not implement this behavior") +py.test.skip("Python3 does not implement this behavior") # This doesn't really test app_main.py, but a behavior that # can only be checked on top of py.py with pexpect. path = getscript(""" @@ -632,7 +632,7 @@ def test_no_space_before_argument(self, monkeypatch): if not hasattr(runpy, '_run_module_as_main'): -skip("requires CPython >= 2.6") +py.test.skip("requires CPython >= 2.6") child = self.spawn(['-cprint("hel" + "lo")']) child.expect('hello') @@ -753,7 +753,7 @@ def test_option_m(self, monkeypatch): if not hasattr(runpy, '_run_module_as_main'): -skip("requires CPython >= 2.6") +py.test.skip("requires CPython >= 2.6") p = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'mymodule.py') p = os.path.abspath(p) monkeypatch.chdir(os.path.dirname(app_main)) @@ -767,7 +767,7 @@ def test_option_m_package(self, monkeypatch): if not hasattr(runpy, '_run_module_as_main'): -skip("requires CPython >= 2.6") +py.test.skip("requires CPython >= 2.6") p = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'mypackage', '__main__.py') p = os.path.abspath(p) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix distutils.sysconfig
Author: Matti PicusBranch: py3.5 Changeset: r94569:28c3a0a86d50 Date: 2018-05-14 14:09 +0300 http://bitbucket.org/pypy/pypy/changeset/28c3a0a86d50/ Log:fix distutils.sysconfig diff --git a/lib-python/3/distutils/sysconfig_pypy.py b/lib-python/3/distutils/sysconfig_pypy.py --- a/lib-python/3/distutils/sysconfig_pypy.py +++ b/lib-python/3/distutils/sysconfig_pypy.py @@ -65,7 +65,7 @@ """Initialize the module as appropriate for POSIX systems.""" from _sysconfigdata import build_time_vars global _config_vars -_config_vars.update(build_time_vars) +_config_vars = build_time_vars def _init_nt(): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix issue #2826
Author: Armin RigoBranch: py3.5 Changeset: r94503:b0d47899b958 Date: 2018-05-09 18:20 +0200 http://bitbucket.org/pypy/pypy/changeset/b0d47899b958/ Log:Fix issue #2826 diff --git a/pypy/objspace/std/specialisedtupleobject.py b/pypy/objspace/std/specialisedtupleobject.py --- a/pypy/objspace/std/specialisedtupleobject.py +++ b/pypy/objspace/std/specialisedtupleobject.py @@ -71,10 +71,6 @@ value = getattr(self, 'value%s' % i) if typetuple[i] == object: y = space.int_w(space.hash(value)) -elif typetuple[i] == int: -# mimic cpythons behavior of a hash value of -2 for -1 -y = value -y -= (y == -1) # No explicit condition, to avoid JIT bridges elif typetuple[i] == float: # get the correct hash for float which is an # integer & other less frequent cases ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix _PyLong_Sign() to accept any app-level 'int' object
Author: Armin RigoBranch: py3.5 Changeset: r94443:a07f07034d28 Date: 2018-04-24 10:00 +0200 http://bitbucket.org/pypy/pypy/changeset/a07f07034d28/ Log:Fix _PyLong_Sign() to accept any app-level 'int' object diff --git a/pypy/module/cpyext/longobject.py b/pypy/module/cpyext/longobject.py --- a/pypy/module/cpyext/longobject.py +++ b/pypy/module/cpyext/longobject.py @@ -2,7 +2,6 @@ from pypy.module.cpyext.api import ( cpython_api, PyObject, build_type_checkers_flags, Py_ssize_t, CONST_STRING, ADDR, CANNOT_FAIL) -from pypy.objspace.std.longobject import W_LongObject from pypy.interpreter.error import OperationError, oefmt from rpython.rlib.rbigint import rbigint, InvalidSignednessError @@ -234,8 +233,8 @@ @cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL) def _PyLong_Sign(space, w_long): -assert isinstance(w_long, W_LongObject) -return w_long.num.sign +bigint = space.bigint_w(w_long) +return bigint.sign CONST_UCHARP = lltype.Ptr(lltype.Array(rffi.UCHAR, hints={'nolength': True, 'render_as_const': True})) diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py --- a/pypy/module/cpyext/test/test_longobject.py +++ b/pypy/module/cpyext/test/test_longobject.py @@ -136,6 +136,9 @@ assert api._PyLong_Sign(space.wraplong(0L)) == 0 assert api._PyLong_Sign(space.wraplong(2L)) == 1 assert api._PyLong_Sign(space.wraplong(-2L)) == -1 +assert api._PyLong_Sign(space.wrap(0)) == 0 +assert api._PyLong_Sign(space.wrap(42)) == 1 +assert api._PyLong_Sign(space.wrap(-42)) == -1 assert api._PyLong_NumBits(space.wrap(0)) == 0 assert api._PyLong_NumBits(space.wrap(1)) == 1 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix different error messages (in several cases this brings us closer to CPython again)
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94382:eccd76eec042 Date: 2018-04-19 12:48 +0200 http://bitbucket.org/pypy/pypy/changeset/eccd76eec042/ Log:fix different error messages (in several cases this brings us closer to CPython again) diff --git a/lib-python/3/test/test_exceptions.py b/lib-python/3/test/test_exceptions.py --- a/lib-python/3/test/test_exceptions.py +++ b/lib-python/3/test/test_exceptions.py @@ -164,10 +164,10 @@ is_pypy = check_impl_detail(pypy=True) check('def fact(x):\n\treturn x!\n', 2, 10) -check('1 +\n', 1, 4 - is_pypy) -check('def spam():\n print(1)\n print(2)', 3, 0 if is_pypy else 10) -check('Python = "Python" +', 1, 20 - is_pypy) -check('Python = "\u1e54\xfd\u0163\u0125\xf2\xf1" +', 1, 20 - is_pypy) +check('1 +\n', 1, 4) +check('def spam():\n print(1)\n print(2)', 3, 2 if is_pypy else 10) +check('Python = "Python" +', 1, 20) +check('Python = "\u1e54\xfd\u0163\u0125\xf2\xf1" +', 1, 20) @cpython_only def testSettingException(self): diff --git a/lib-python/3/test/test_fstring.py b/lib-python/3/test/test_fstring.py --- a/lib-python/3/test/test_fstring.py +++ b/lib-python/3/test/test_fstring.py @@ -319,7 +319,7 @@ ["f'{3)+(4}'", ]) -self.assertAllRaise(SyntaxError, 'EOL while scanning string literal', +self.assertAllRaise(SyntaxError, r'end of line \(EOL\) while scanning string literal', ["f'{\n}'", ]) @@ -741,7 +741,7 @@ self.assertEqual('{d[0]}'.format(d=d), 'integer') def test_invalid_expressions(self): -self.assertAllRaise(SyntaxError, 'invalid syntax', +self.assertAllRaise(SyntaxError, "closing parenthesis '.' does not match opening parenthesis '.'", [r"f'{a[4)}'", r"f'{a(4]}'", ]) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix for linux32
Author: Matti PicusBranch: py3.5 Changeset: r94304:242e7ff776ce Date: 2018-04-11 05:52 +0300 http://bitbucket.org/pypy/pypy/changeset/242e7ff776ce/ Log:fix for linux32 diff --git a/pypy/module/_rawffi/alt/test/test_struct.py b/pypy/module/_rawffi/alt/test/test_struct.py --- a/pypy/module/_rawffi/alt/test/test_struct.py +++ b/pypy/module/_rawffi/alt/test/test_struct.py @@ -54,17 +54,18 @@ def setup_class(cls): BaseAppTestFFI.setup_class.im_func(cls) +from rpython.rlib import clibffi +from rpython.rlib.rarithmetic import r_uint +from rpython.rtyper.lltypesystem import lltype, rffi + if cls.runappdirect: cls.w_read_raw_mem = cls.read_raw_mem else: -@unwrap_spec(addr=int, typename='text', length=int) +@unwrap_spec(addr=r_uint, typename='text', length=int) def read_raw_mem_w(space, addr, typename, length): return space.wrap(cls.read_raw_mem(addr, typename, length)) cls.w_read_raw_mem = cls.space.wrap(interp2app(read_raw_mem_w)) # -from rpython.rlib import clibffi -from rpython.rlib.rarithmetic import r_uint -from rpython.rtyper.lltypesystem import lltype, rffi dummy_type = lltype.malloc(clibffi.FFI_TYPE_P.TO, flavor='raw') dummy_type.c_size = r_uint(123) dummy_type.c_alignment = rffi.cast(rffi.USHORT, 0) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix doctests
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r94296:d9e2802b64a3 Date: 2018-04-10 10:39 +0200 http://bitbucket.org/pypy/pypy/changeset/d9e2802b64a3/ Log:fix doctests diff --git a/lib-python/3/test/test_syntax.py b/lib-python/3/test/test_syntax.py --- a/lib-python/3/test/test_syntax.py +++ b/lib-python/3/test/test_syntax.py @@ -110,12 +110,12 @@ >>> def f(x, None): ... pass Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax (expected ')') >>> def f(*None): ... pass Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax (expected ')') >>> def f(**None): ... pass ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge
Author: Matti PicusBranch: py3.5 Changeset: r94242:4e6fcbd80661 Date: 2018-04-05 08:43 +0300 http://bitbucket.org/pypy/pypy/changeset/4e6fcbd80661/ Log:fix merge diff --git a/pypy/interpreter/pyparser/pyparse.py b/pypy/interpreter/pyparser/pyparse.py --- a/pypy/interpreter/pyparser/pyparse.py +++ b/pypy/interpreter/pyparser/pyparse.py @@ -148,12 +148,12 @@ raise if enc is not None: compile_info.encoding = enc +if explicit_encoding: +compile_info.flags |= consts.PyCF_FOUND_ENCODING return self._parse(textsrc, compile_info) def _parse(self, textsrc, compile_info): flags = compile_info.flags -if explicit_encoding: -flags |= consts.PyCF_FOUND_ENCODING # The tokenizer is very picky about how it wants its input. source_lines = textsrc.splitlines(True) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test, implement userslot for __call__ needed for python-defined class
Author: Matti PicusBranch: py3.5 Changeset: r94142:c9ce25047019 Date: 2018-03-27 01:10 +0300 http://bitbucket.org/pypy/pypy/changeset/c9ce25047019/ Log:fix test, implement userslot for __call__ needed for python-defined class diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py --- a/pypy/module/cpyext/test/test_cpyext.py +++ b/pypy/module/cpyext/test/test_cpyext.py @@ -364,7 +364,7 @@ self.unimport_module(name) self.cleanup() state = self.space.fromcache(State) -assert not state.operror +assert 'operror' not in dir(state) class AppTestCpythonExtension(AppTestCpythonExtensionBase): diff --git a/pypy/module/cpyext/userslot.py b/pypy/module/cpyext/userslot.py --- a/pypy/module/cpyext/userslot.py +++ b/pypy/module/cpyext/userslot.py @@ -49,6 +49,11 @@ w_stararg=w_args, w_starstararg=w_kwds) return space.call_args(w_impl, args) +@slot_function([PyObject, PyObject, PyObject], PyObject) +def slot_tp_call(space, w_self, w_args, w_kwds): +args = Arguments(space, [], w_stararg=w_args, w_starstararg=w_kwds) +return space.call_args(w_self, args) + # unary functions @slot_function([PyObject], PyObject) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge, minimize diff to default
Author: Matti PicusBranch: py3.5 Changeset: r94141:fcce464367d8 Date: 2018-03-27 01:05 +0300 http://bitbucket.org/pypy/pypy/changeset/fcce464367d8/ Log:fix merge, minimize diff to default diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -1,3 +1,4 @@ +import pytest from pypy.interpreter import gateway from rpython.rtyper.lltypesystem import rffi from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase @@ -6,8 +7,6 @@ from pypy.module.cpyext.pyobject import make_ref, from_ref, decref, as_pyobj from pypy.module.cpyext.typeobject import cts, PyTypeObjectPtr -import sys -import pytest class AppTestTypeObject(AppTestCpythonExtensionBase): @@ -243,6 +242,29 @@ module = self.import_module(name='foo') raises(TypeError, module.MetaType, 'other', (module.fooType,), {}) +def test_sre(self): +import sys +for m in ['_sre', 'sre_compile', 'sre_constants', 'sre_parse', 're']: +# clear out these modules +try: +del sys.modules[m] +except KeyError: +pass +module = self.import_module(name='_sre') +import re +assert re.sre_compile._sre is module +s = u"Foo " * 1000 + u"Bar" +prog = re.compile(u"Foo.*Bar") +assert prog.match(s) +m = re.search(u"xyz", u"xyzxyz") +assert m +m = re.search("xyz", "xyzxyz") +assert m +assert "groupdict" in dir(m) +re._cache.clear() +re._cache_repl.clear() +del prog, m + def test_init_error(self): module = self.import_module("foo") raises(ValueError, module.InitErrType) @@ -519,7 +541,7 @@ py_type = rffi.cast(PyTypeObjectPtr, ref) w_dict = from_ref(space, py_type.c_tp_dict) -w_name = space.newunicode(u'a') +w_name = space.newtext('a') space.setitem(w_dict, w_name, space.wrap(1)) assert space.int_w(space.getattr(w_class, w_name)) == 1 space.delitem(w_dict, w_name) @@ -549,6 +571,7 @@ def test_typeslots(self, space): assert cts.macros['Py_tp_doc'] == 56 + class AppTestSlots(AppTestCpythonExtensionBase): def setup_class(cls): AppTestCpythonExtensionBase.setup_class.im_func(cls) @@ -603,16 +626,21 @@ module = self.import_extension('foo', [ ("test_tp_getattro", "METH_VARARGS", ''' - PyObject *obj = PyTuple_GET_ITEM(args, 0); - PyObject *value = PyTuple_GET_ITEM(args, 1); + #if PY_MAJOR_VERSION > 2 + #define PyString_FromString PyUnicode_FromString + #define PyIntObject PyLongObject + #define PyInt_AsLong PyLong_AsLong + #endif + PyObject *name, *obj = PyTuple_GET_ITEM(args, 0); + PyObject *attr, *value = PyTuple_GET_ITEM(args, 1); if (!obj->ob_type->tp_getattro) { PyErr_SetString(PyExc_ValueError, "missing tp_getattro"); return NULL; } - PyObject *name = PyUnicode_FromString("attr1"); - PyObject *attr = obj->ob_type->tp_getattro(obj, name); - if (PyLong_AsLong(attr) != PyLong_AsLong(value)) + name = PyString_FromString("attr1"); + attr = obj->ob_type->tp_getattro(obj, name); + if (PyInt_AsLong(attr) != PyInt_AsLong(value)) { PyErr_SetString(PyExc_ValueError, "tp_getattro returned wrong value"); @@ -620,7 +648,7 @@ } Py_DECREF(name); Py_DECREF(attr); - name = PyUnicode_FromString("attr2"); + name = PyString_FromString("attr2"); attr = obj->ob_type->tp_getattro(obj, name); if (attr == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -644,6 +672,9 @@ module = self.import_extension('foo', [ ("get_foo", "METH_O", ''' + #if PY_MAJOR_VERSION > 2 + #define PyString_FromString PyUnicode_FromString + #endif char* name = "foo"; PyTypeObject *tp = Py_TYPE(args); PyObject *res; @@ -651,7 +682,7 @@ res = (*tp->tp_getattr)(args, name); } else if (tp->tp_getattro != NULL) { - PyObject *w = PyUnicode_FromString(name); + PyObject *w = PyString_FromString(name); res = (*tp->tp_getattro)(args, w); Py_DECREF(w); } @@ -736,17 +767,23 @@ module =
[pypy-commit] pypy py3.5: fix
Author: Matti PicusBranch: py3.5 Changeset: r94058:b13c7b3ad6ee Date: 2018-03-21 22:39 +0200 http://bitbucket.org/pypy/pypy/changeset/b13c7b3ad6ee/ Log:fix diff --git a/lib-python/3/distutils/msvc9compiler.py b/lib-python/3/distutils/msvc9compiler.py --- a/lib-python/3/distutils/msvc9compiler.py +++ b/lib-python/3/distutils/msvc9compiler.py @@ -278,7 +278,7 @@ stdout = stdout.decode("mbcs") log.debug('-'*30) log.debug(stderr.decode('mbcs')) -log.debug(stdout.decode('mbcs')) +log.debug(stdout) log.debug('-'*30) for line in stdout.split("\n"): line = Reg.convert_mbcs(line) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix tests, remaining test_rename failure succeeds on cpython3
Author: Matti PicusBranch: py3.5 Changeset: r93967:19f63e72f7ce Date: 2018-03-11 00:09 +0200 http://bitbucket.org/pypy/pypy/changeset/19f63e72f7ce/ Log:fix tests, remaining test_rename failure succeeds on cpython3 diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -1087,12 +1087,11 @@ if sys.platform == 'win32': os.chmod(my_path, 0o400) assert (os.stat(my_path).st_mode & 0o600) == 0o400 -os.chmod(self.path, 0700) +os.chmod(self.path, 0o700) else: os.chmod(my_path, 0o200) assert (os.stat(my_path).st_mode & 0o777) == 0o200 -os.chmod(self.path, 0700) -os.unlink(self.path) +os.chmod(self.path, 0o700) if hasattr(os, 'fchmod'): def test_fchmod(self): @@ -1103,7 +1102,6 @@ assert (os.fstat(f.fileno()).st_mode & 0o777) == 0o200 f.close() assert (os.stat(my_path).st_mode & 0o777) == 0o200 -os.unlink(self.path) if hasattr(os, 'mkfifo'): def test_mkfifo(self): @@ -1407,16 +1405,17 @@ def test_rename(self): os = self.posix -with open(self.path, "w") as f: +fname = self.path2 + 'rename.txt' +with open(fname, "w") as f: f.write("this is a rename test") unicode_name = str(self.udir) + u'/test\u03be.txt' -os.rename(self.path, unicode_name) +os.rename(fname, unicode_name) with open(unicode_name) as f: assert f.read() == 'this is a rename test' -os.rename(unicode_name, self.path) -with open(self.path) as f: +os.rename(unicode_name, fname) +with open(fname) as f: assert f.read() == 'this is a rename test' -os.unlink(self.path) +os.unlink(fname) def test_device_encoding(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix a test
Author: Matti PicusBranch: py3.5 Changeset: r93891:ac0bb5a87469 Date: 2018-02-26 21:24 -0500 http://bitbucket.org/pypy/pypy/changeset/ac0bb5a87469/ Log:fix a test diff --git a/pypy/interpreter/test/test_zpy.py b/pypy/interpreter/test/test_zpy.py --- a/pypy/interpreter/test/test_zpy.py +++ b/pypy/interpreter/test/test_zpy.py @@ -113,6 +113,7 @@ def test_pytrace(): output = run(sys.executable, pypypath, '-S', stdin="__pytrace__ = 1\nx = 5\nx") +output = output.replace('\r\n', '\n') assert ('\t: LOAD_CONST0 (5)\n' '\t: STORE_NAME0 (x)\n' '\t: LOAD_CONST1 (None)\n' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix decimal
Author: Matti PicusBranch: py3.5 Changeset: r93861:e7ca5c644d47 Date: 2018-02-22 00:42 +0200 http://bitbucket.org/pypy/pypy/changeset/e7ca5c644d47/ Log:fix decimal diff --git a/lib_pypy/_libmpdec/vccompat.h b/lib_pypy/_libmpdec/vccompat.h --- a/lib_pypy/_libmpdec/vccompat.h +++ b/lib_pypy/_libmpdec/vccompat.h @@ -34,6 +34,8 @@ #ifdef _MSC_VER #if _MSC_VER < 1900 #include "vcstdint.h" + #else + #include "stdint.h" #endif #undef inline #define inline __inline ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix tests
Author: Ronan LamyBranch: py3.5 Changeset: r93840:a5f69bc67c34 Date: 2018-02-20 03:10 + http://bitbucket.org/pypy/pypy/changeset/a5f69bc67c34/ Log:fix tests diff --git a/pypy/module/thread/test/test_local.py b/pypy/module/thread/test/test_local.py --- a/pypy/module/thread/test/test_local.py +++ b/pypy/module/thread/test/test_local.py @@ -102,8 +102,8 @@ assert len(done) == 5 def test_weakrefable(self): -import thread, weakref -weakref.ref(thread._local()) +import _thread, weakref +weakref.ref(_thread._local()) def test_local_is_not_immortal(self): import _thread, gc, time diff --git a/pypy/module/thread/test/test_lock.py b/pypy/module/thread/test/test_lock.py --- a/pypy/module/thread/test/test_lock.py +++ b/pypy/module/thread/test/test_lock.py @@ -53,8 +53,8 @@ assert lock.locked() is False def test_weakrefable(self): -import thread, weakref -weakref.ref(thread.allocate_lock()) +import _thread, weakref +weakref.ref(_thread.allocate_lock()) def test_timeout(self): import _thread ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test (os.environ != posix.environ)
Author: Ronan LamyBranch: py3.5 Changeset: r93833:f7cdc20cd320 Date: 2018-02-19 20:22 + http://bitbucket.org/pypy/pypy/changeset/f7cdc20cd320/ Log:Fix test (os.environ != posix.environ) diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -1478,10 +1478,9 @@ def test_environ(self): import sys, os environ = os.environ -item_type = str if sys.platform.startswith('win') else bytes for k, v in environ.items(): -assert type(k) is item_type -assert type(v) is item_type +assert type(k) is str +assert type(v) is str name = next(iter(environ)) assert environ[name] is not None del environ[name] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93832:5e9a14e1be53 Date: 2018-02-19 19:33 + http://bitbucket.org/pypy/pypy/changeset/5e9a14e1be53/ Log:fix test diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py --- a/pypy/module/cpyext/test/test_longobject.py +++ b/pypy/module/cpyext/test/test_longobject.py @@ -277,23 +277,23 @@ free(bytes); return NULL; } - result = PyString_FromStringAndSize((const char *)bytes, n); + result = PyBytes_FromStringAndSize((const char *)bytes, n); free(bytes); return result; """), ]) s = module.as_bytearray(0x41BC9A, 4, True, False) -assert s == "\x9A\xBC\x41\x00" +assert s == b"\x9A\xBC\x41\x00" s = module.as_bytearray(0x41BC9A, 4, False, False) -assert s == "\x00\x41\xBC\x9A" +assert s == b"\x00\x41\xBC\x9A" s = module.as_bytearray(0x41BC9A, 3, True, False) -assert s == "\x9A\xBC\x41" +assert s == b"\x9A\xBC\x41" s = module.as_bytearray(0x41BC9A, 3, True, True) -assert s == "\x9A\xBC\x41" +assert s == b"\x9A\xBC\x41" s = module.as_bytearray(0x9876, 2, True, False) -assert s == "\x76\x98" +assert s == b"\x76\x98" s = module.as_bytearray(0x9876 - 0x1, 2, True, True) -assert s == "\x76\x98" +assert s == b"\x76\x98" raises(OverflowError, module.as_bytearray, 0x9876, 2, False, True) raises(OverflowError, module.as_bytearray, ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix mapdict-size-limit on pypy3
Author: Carl Friedrich Bolz-TereickBranch: py3.5 Changeset: r93820:ff6a031587c2 Date: 2018-02-14 16:37 +0100 http://bitbucket.org/pypy/pypy/changeset/ff6a031587c2/ Log:fix mapdict-size-limit on pypy3 diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py --- a/pypy/objspace/std/mapdict.py +++ b/pypy/objspace/std/mapdict.py @@ -4,6 +4,7 @@ from rpython.rlib.rarithmetic import intmask, r_uint from pypy.interpreter.baseobjspace import W_Root +from pypy.interpreter.unicodehelper import encode_utf8 from pypy.objspace.std.dictmultiobject import ( W_DictMultiObject, DictStrategy, ObjectDictStrategy, BaseKeyIterator, BaseValueIterator, BaseItemIterator, _never_equal_to_string, @@ -27,7 +28,7 @@ # the maximum number of attributes stored in mapdict (afterwards just use a # dict) -LIMIT_MAP_ATTRIBUTES = 8000 +LIMIT_MAP_ATTRIBUTES = 80 class AbstractAttribute(object): @@ -431,7 +432,8 @@ def materialize_str_dict(self, space, obj, str_dict): new_obj = self.back.materialize_str_dict(space, obj, str_dict) if self.index == DICT: -str_dict[self.name] = obj._mapdict_read_storage(self.storageindex) +enc_name = encode_utf8(space, self.name) +str_dict[enc_name] = obj._mapdict_read_storage(self.storageindex) else: self._copy_attr(obj, new_obj) return new_obj @@ -767,7 +769,7 @@ def switch_to_text_strategy(self, w_dict): w_obj = self.unerase(w_dict.dstorage) -strategy = self.space.fromcache(BytesDictStrategy) +strategy = self.space.fromcache(UnicodeDictStrategy) str_dict = strategy.unerase(strategy.get_empty_storage()) w_dict.set_strategy(strategy) w_dict.dstorage = strategy.erase(str_dict) diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py --- a/pypy/objspace/std/test/test_mapdict.py +++ b/pypy/objspace/std/test/test_mapdict.py @@ -125,6 +125,7 @@ obj.setdictvalue(space, str(i), i) # moved to dict (which is the remaining non-slot item) assert len(obj.storage) == 1 + numslots +assert isinstance(obj.getdict(space).dstrategy, UnicodeDictStrategy) for i in range(1000): assert obj.getdictvalue(space, str(i)) == i ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test for python3
Author: Matti PicusBranch: py3.5 Changeset: r93798:8c123f06687c Date: 2018-02-11 09:00 -0500 http://bitbucket.org/pypy/pypy/changeset/8c123f06687c/ Log:fix test for python3 diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py --- a/pypy/module/cpyext/test/test_longobject.py +++ b/pypy/module/cpyext/test/test_longobject.py @@ -282,24 +282,24 @@ return result; """), ]) -s = module.as_bytearray(0x41BC9AL, 4, True, False) +s = module.as_bytearray(0x41BC9A, 4, True, False) assert s == "\x9A\xBC\x41\x00" -s = module.as_bytearray(0x41BC9AL, 4, False, False) +s = module.as_bytearray(0x41BC9A, 4, False, False) assert s == "\x00\x41\xBC\x9A" -s = module.as_bytearray(0x41BC9AL, 3, True, False) +s = module.as_bytearray(0x41BC9A, 3, True, False) assert s == "\x9A\xBC\x41" -s = module.as_bytearray(0x41BC9AL, 3, True, True) +s = module.as_bytearray(0x41BC9A, 3, True, True) assert s == "\x9A\xBC\x41" -s = module.as_bytearray(0x9876L, 2, True, False) +s = module.as_bytearray(0x9876, 2, True, False) assert s == "\x76\x98" -s = module.as_bytearray(0x9876L - 0x1L, 2, True, True) +s = module.as_bytearray(0x9876 - 0x1, 2, True, True) assert s == "\x76\x98" raises(OverflowError, module.as_bytearray, - 0x9876L, 2, False, True) + 0x9876, 2, False, True) raises(OverflowError, module.as_bytearray, - -1L, 2, True, False) + -1, 2, True, False) raises(OverflowError, module.as_bytearray, - 0x1234567L, 3, True, False) + 0x1234567, 3, True, False) def test_fromunicode(self): module = self.import_extension('foo', [ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix isfinite calls that incorrectly became isinf in a7d7fd1b9931
Author: Benjamin PetersonBranch: py3.5 Changeset: r93690:dbc3ed3f19fb Date: 2018-01-20 10:44 -0800 http://bitbucket.org/pypy/pypy/changeset/dbc3ed3f19fb/ Log:fix isfinite calls that incorrectly became isinf in a7d7fd1b9931 diff --git a/pypy/module/math/interp_math.py b/pypy/module/math/interp_math.py --- a/pypy/module/math/interp_math.py +++ b/pypy/module/math/interp_math.py @@ -355,8 +355,8 @@ v = hi del partials[added:] if v != 0.0: -if not math.isinf(v): -if math.isinf(original): +if not rfloat.isfinite(v): +if rfloat.isfinite(original): raise oefmt(space.w_OverflowError, "intermediate overflow") if math.isinf(original): inf_sum += original ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge
Author: Matti PicusBranch: py3.5 Changeset: r93688:db253d82be12 Date: 2018-01-20 19:24 +0200 http://bitbucket.org/pypy/pypy/changeset/db253d82be12/ Log:fix merge diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py --- a/pypy/objspace/std/floatobject.py +++ b/pypy/objspace/std/floatobject.py @@ -731,8 +731,10 @@ def _hash_float(space, v): -if math.isnan(v): -return 0 +if not isfinite(v): +if isinf(v): +return HASH_INF if v > 0 else -HASH_INF +return HASH_NAN m, e = math.frexp(v) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge
Author: Matti PicusBranch: py3.5 Changeset: r93687:a7d7fd1b9931 Date: 2018-01-19 17:00 +0200 http://bitbucket.org/pypy/pypy/changeset/a7d7fd1b9931/ Log:fix merge diff --git a/pypy/interpreter/timeutils.py b/pypy/interpreter/timeutils.py --- a/pypy/interpreter/timeutils.py +++ b/pypy/interpreter/timeutils.py @@ -22,7 +22,7 @@ def timestamp_w(space, w_secs): if space.isinstance_w(w_secs, space.w_float): secs = space.float_w(w_secs) -if rfloat.isnan(secs): +if math.isnan(secs): raise oefmt(space.w_ValueError, "timestamp is nan") result_float = math.ceil(secs * SECS_TO_NS) try: diff --git a/pypy/module/cmath/interp_cmath.py b/pypy/module/cmath/interp_cmath.py --- a/pypy/module/cmath/interp_cmath.py +++ b/pypy/module/cmath/interp_cmath.py @@ -215,8 +215,8 @@ # sign would otherwise have an infinite relative tolerance. # Two infinities of the same sign are caught by the equality check # above. -if (rfloat.isinf(ax) or rfloat.isinf(ay) or -rfloat.isinf(bx) or rfloat.isinf(by)): +if (math.isinf(ax) or math.isinf(ay) or +math.isinf(bx) or math.isinf(by)): return space.w_False # # now do the regular computation diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py --- a/pypy/module/cpyext/cdatetime.py +++ b/pypy/module/cpyext/cdatetime.py @@ -79,8 +79,6 @@ return space.is_true( space.appexec([w_obj], """(obj): from datetime import %s as datatype -if not isinstance(obj, datatype): -print datatype return isinstance(obj, datatype) """ % (type_name,))) except OperationError: diff --git a/pypy/module/math/interp_math.py b/pypy/module/math/interp_math.py --- a/pypy/module/math/interp_math.py +++ b/pypy/module/math/interp_math.py @@ -355,8 +355,8 @@ v = hi del partials[added:] if v != 0.0: -if not rfloat.isfinite(v): -if rfloat.isfinite(original): +if not math.isinf(v): +if math.isinf(original): raise oefmt(space.w_OverflowError, "intermediate overflow") if math.isinf(original): inf_sum += original @@ -473,7 +473,7 @@ # sign would otherwise have an infinite relative tolerance. # Two infinities of the same sign are caught by the equality check # above. -if rfloat.isinf(a) or rfloat.isinf(b): +if math.isinf(a) or math.isinf(b): return space.w_False # # now do the regular computation diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py --- a/pypy/objspace/std/floatobject.py +++ b/pypy/objspace/std/floatobject.py @@ -7,7 +7,7 @@ from rpython.rlib.rarithmetic import int_between from rpython.rlib.rbigint import rbigint from rpython.rlib.rfloat import ( -DTSF_ADD_DOT_0, INFINITY, NAN, copysign, +DTSF_ADD_DOT_0, INFINITY, NAN, float_as_rbigint_ratio, formatd, isfinite) from rpython.rlib.rstring import ParseStringError from rpython.rlib.unroll import unrolling_iterable @@ -918,6 +918,6 @@ # finite x, and ndigits is not unreasonably large z = rfloat.round_double(x, ndigits, half_even=True) -if rfloat.isinf(z): +if math.isinf(z): raise oefmt(space.w_OverflowError, "overflow occurred during round") return space.newfloat(z) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix/skip easy tests (test_codecs checked on cpython3)
Author: Matti PicusBranch: py3.5 Changeset: r93641:f5c9251c71a6 Date: 2018-01-08 23:19 +0200 http://bitbucket.org/pypy/pypy/changeset/f5c9251c71a6/ Log:fix/skip easy tests (test_codecs checked on cpython3) diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py --- a/pypy/module/_codecs/test/test_codecs.py +++ b/pypy/module/_codecs/test/test_codecs.py @@ -892,7 +892,7 @@ assert False, 'cannot test mbcs on this windows system, check code page' assert u'test'.encode('mbcs') == b'test' assert toencode[0].encode('mbcs') == toencode[1] -assert u'\u040a'.encode('mbcs') == b'?' # some cyrillic letter +raises(UnicodeEncodeError, u'\u040a'.encode, 'mbcs') assert b'cafx\e9'.decode('mbcs') == u'cafx\e9' def test_handler_string_result(self): diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -1424,6 +1424,7 @@ skip("_getfinalpathname not supported on this platform") assert os.path.exists(result) +@py.test.mark.skipif("sys.platform == 'win32'") def test_rtld_constants(self): # check presence of major RTLD_* constants self.posix.RTLD_LAZY @@ -1432,6 +1433,7 @@ self.posix.RTLD_LOCAL def test_error_message(self): +import sys e = raises(OSError, self.posix.open, 'nonexistentfile1', 0) assert str(e.value).endswith(": 'nonexistentfile1'") @@ -1442,8 +1444,9 @@ e = raises(OSError, self.posix.replace, 'nonexistentfile1', 'bok') assert str(e.value).endswith(": 'nonexistentfile1' -> 'bok'") -e = raises(OSError, self.posix.symlink, 'bok', '/nonexistentdir/boz') -assert str(e.value).endswith(": 'bok' -> '/nonexistentdir/boz'") +if sys.platform != 'win32': +e = raises(OSError, self.posix.symlink, 'bok', '/nonexistentdir/boz') +assert str(e.value).endswith(": 'bok' -> '/nonexistentdir/boz'") if hasattr(rposix, 'getxattr'): def test_xattr_simple(self): @@ -1472,8 +1475,8 @@ cls.w_path = space.wrap(str(path)) def test_environ(self): -import sys, posix -environ = posix.environ +import sys, os +environ = os.environ item_type = str if sys.platform.startswith('win') else bytes for k, v in environ.items(): assert type(k) is item_type @@ -1536,25 +1539,25 @@ class AppTestPosixUnicode: def test_stat_unicode(self): # test that passing unicode would not raise UnicodeDecodeError -import posix +import os try: -posix.stat(u"") +os.stat(u"") except OSError: pass def test_open_unicode(self): # Ensure passing unicode doesn't raise UnicodeEncodeError -import posix +import os try: -posix.open(u"", posix.O_WRONLY) +os.open(u"", os.O_WRONLY) except OSError: pass def test_remove_unicode(self): # See 2 above ;) -import posix +import os try: -posix.remove(u"") +os.remove(u"") except OSError: pass ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix for python 3
Author: Armin RigoBranch: py3.5 Changeset: r93638:3352216b0e57 Date: 2018-01-08 16:04 +0100 http://bitbucket.org/pypy/pypy/changeset/3352216b0e57/ Log:Fix for python 3 diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py --- a/lib_pypy/_ctypes/array.py +++ b/lib_pypy/_ctypes/array.py @@ -12,8 +12,7 @@ if cls == (_CData,): # this is the Array class defined below res._ffiarray = None return res -if not hasattr(res, '_length_') or not isinstance(res._length_, - (int, long)): +if not hasattr(res, '_length_') or not isinstance(res._length_, int): raise AttributeError( "class must define a '_length_' attribute, " "which must be a positive integer") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix 0c5a75555005, DLOpenError msg must be str not unicode
Author: Matti PicusBranch: py3.5 Changeset: r93637:caa299dc43a2 Date: 2018-01-08 11:24 +0200 http://bitbucket.org/pypy/pypy/changeset/caa299dc43a2/ Log:fix 0c5a7005, DLOpenError msg must be str not unicode diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py --- a/pypy/module/_rawffi/interp_rawffi.py +++ b/pypy/module/_rawffi/interp_rawffi.py @@ -154,7 +154,7 @@ msg = e.msg if we_are_translated() else repr(e.msg) else: msg = 'unspecified error' -return oefmt(space.w_OSError, 'Cannot load library %s: %s', filename, msg) +return oefmt(space.w_OSError, 'Cannot load library %s: %8', filename, msg) class W_CDLL(W_Root): diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py --- a/rpython/rlib/rdynload.py +++ b/rpython/rlib/rdynload.py @@ -228,7 +228,9 @@ res = rwin32.LoadLibrary(name) if not res: err = rwin32.GetLastError_saved() -raise DLOpenError(rwin32.FormatErrorW(err)) +ustr = rwin32.FormatErrorW(err) +# DLOpenError unicode msg breaks translation of cpyext create_extension_module +raise DLOpenError(ustr.encode('utf-8')) return res def dlclose(handle): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation?
Author: Matti PicusBranch: py3.5 Changeset: r93636:29875e4930fc Date: 2018-01-08 08:09 +0200 http://bitbucket.org/pypy/pypy/changeset/29875e4930fc/ Log:fix translation? diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py --- a/pypy/module/cpyext/methodobject.py +++ b/pypy/module/cpyext/methodobject.py @@ -190,7 +190,7 @@ assert isinstance(w_objclass, W_TypeObject) raise oefmt(space.w_TypeError, "descriptor '%8' of '%s' object needs an argument", -self.name, w_objclass.name) +self.name, self.w_objclass.getname(space)) w_instance = __args__.arguments_w[0] # XXX: needs a stricter test if not space.isinstance_w(w_instance, self.w_objclass): @@ -230,7 +230,7 @@ def descr_call(self, space, __args__): if len(__args__.arguments_w) == 0: raise oefmt(space.w_TypeError, -"descriptor '%s' of '%s' object needs an argument", +"descriptor '%8' of '%s' object needs an argument", self.name, self.w_objclass.getname(space)) w_instance = __args__.arguments_w[0] # XXX typecheck missing # CCC: we can surely do better than this ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix for issue #2716
Author: Matti PicusBranch: py3.5 Changeset: r93631:0c5a7005 Date: 2018-01-07 22:27 +0200 http://bitbucket.org/pypy/pypy/changeset/0c5a7005/ Log:fix for issue #2716 diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py --- a/rpython/rlib/rdynload.py +++ b/rpython/rlib/rdynload.py @@ -228,7 +228,7 @@ res = rwin32.LoadLibrary(name) if not res: err = rwin32.GetLastError_saved() -raise DLOpenError(rwin32.FormatError(err)) +raise DLOpenError(rwin32.FormatErrorW(err)) return res def dlclose(handle): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix err.filename when *xattr() functions raise an OSError
Author: Ronan LamyBranch: py3.5 Changeset: r93600:49d834e68cbe Date: 2017-12-29 20:06 +0100 http://bitbucket.org/pypy/pypy/changeset/49d834e68cbe/ Log:Fix err.filename when *xattr() functions raise an OSError diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -2304,13 +2304,13 @@ try: result = rposix.fgetxattr(path.as_fd, attribute.as_bytes) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) else: try: result = rposix.getxattr(path.as_bytes, attribute.as_bytes, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) return space.newbytes(result) @unwrap_spec(path=path_or_fd(), attribute=path_or_fd(allow_fd=False), @@ -2333,13 +2333,13 @@ try: rposix.fsetxattr(path.as_fd, attribute.as_bytes, value, flags) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) else: try: rposix.setxattr(path.as_bytes, attribute.as_bytes, value, flags, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) @unwrap_spec(path=path_or_fd(), attribute=path_or_fd(allow_fd=False), @@ -2359,13 +2359,13 @@ try: rposix.fremovexattr(path.as_fd, attribute.as_bytes) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) else: try: rposix.removexattr(path.as_bytes, attribute.as_bytes, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) @unwrap_spec(path=path_or_fd(), follow_symlinks=bool) @@ -2386,12 +2386,12 @@ try: result = rposix.flistxattr(path.as_fd) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror2(space, e, path.w_path) else: try: result = rposix.listxattr(path.as_bytes, follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, path.as_bytes) +raise wrap_oserror2(space, e, path.w_path) return space.newlist([space.newfilename(attr) for attr in result]) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix target_name
Author: Matti PicusBranch: py3.5 Changeset: r93599:3e7cb4758b05 Date: 2017-12-29 16:15 +0200 http://bitbucket.org/pypy/pypy/changeset/3e7cb4758b05/ Log:fix target_name diff --git a/testrunner/get_info.py b/testrunner/get_info.py --- a/testrunner/get_info.py +++ b/testrunner/get_info.py @@ -9,7 +9,7 @@ BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) if sys.platform.startswith('win'): -TARGET_NAME = r'Scripts\\pypy3-c.exe' +TARGET_NAME = r'pypy3-c.exe' TARGET_DIR = 'Scripts' else: TARGET_NAME = 'pypy3-c' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix: the 'flags' argument to setxattr() had no effect
Author: Ronan LamyBranch: py3.5 Changeset: r93589:70dfe4f14f67 Date: 2017-12-28 16:56 +0100 http://bitbucket.org/pypy/pypy/changeset/70dfe4f14f67/ Log:Fix: the 'flags' argument to setxattr() had no effect diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -2331,12 +2331,12 @@ raise oefmt(space.w_ValueError, "setxattr: cannot use fd and follow_symlinks together") try: -rposix.fsetxattr(path.as_fd, attribute.as_bytes, value) +rposix.fsetxattr(path.as_fd, attribute.as_bytes, value, flags) except OSError as e: raise wrap_oserror(space, e, path.as_bytes) else: try: -rposix.setxattr(path.as_bytes, attribute.as_bytes, value, +rposix.setxattr(path.as_bytes, attribute.as_bytes, value, flags, follow_symlinks=follow_symlinks) except OSError as e: raise wrap_oserror(space, e, path.as_bytes) diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -1455,6 +1455,8 @@ excinfo = raises(OSError, os.getxattr, self.path, 'user.test') assert excinfo.value.filename == self.path os.setxattr(self.path, 'user.test', b'', os.XATTR_CREATE, follow_symlinks=False) +raises(OSError, +os.setxattr, self.path, 'user.test', b'', os.XATTR_CREATE) assert os.getxattr(self.path, 'user.test') == b'' os.setxattr(self.path, b'user.test', b'foo', os.XATTR_REPLACE) assert os.getxattr(self.path, 'user.test', follow_symlinks=False) == b'foo' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix issue #2717
Author: Ronan LamyBranch: py3.5 Changeset: r93587:f145d8504387 Date: 2017-12-28 15:57 +0100 http://bitbucket.org/pypy/pypy/changeset/f145d8504387/ Log:Fix issue #2717 diff --git a/pypy/interpreter/test/test_timeutils.py b/pypy/interpreter/test/test_timeutils.py new file mode 100644 --- /dev/null +++ b/pypy/interpreter/test/test_timeutils.py @@ -0,0 +1,13 @@ +import pytest +from rpython.rlib.rarithmetic import r_longlong +from pypy.interpreter.error import OperationError +from pypy.interpreter.timeutils import timestamp_w + +def test_timestamp_w(space): +w_1_year = space.newint(365 * 24 * 3600) +result = timestamp_w(space, w_1_year) +assert isinstance(result, r_longlong) +assert result // 10 ** 9 == space.int_w(w_1_year) +w_millenium = space.mul(w_1_year, space.newint(1000)) +with pytest.raises(OperationError): # timestamps overflow after ~300 years +timestamp_w(space, w_millenium) diff --git a/pypy/interpreter/timeutils.py b/pypy/interpreter/timeutils.py --- a/pypy/interpreter/timeutils.py +++ b/pypy/interpreter/timeutils.py @@ -3,7 +3,7 @@ """ import math from rpython.rlib.rarithmetic import ( -r_longlong, ovfcheck, ovfcheck_float_to_longlong) +r_longlong, ovfcheck_float_to_longlong) from rpython.rlib import rfloat from pypy.interpreter.error import oefmt @@ -31,10 +31,10 @@ raise oefmt(space.w_OverflowError, "timestamp %R too large to convert to C _PyTime_t", w_secs) else: -sec = space.int_w(w_secs) try: -result = ovfcheck(sec * SECS_TO_NS) +sec = space.bigint_w(w_secs).tolonglong() +result = sec * r_longlong(SECS_TO_NS) except OverflowError: raise oefmt(space.w_OverflowError, -"timestamp too large to convert to C _PyTime_t") -return r_longlong(result) +"timestamp %R too large to convert to C _PyTime_t", w_secs) +return result ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix for win32
Author: Matti PicusBranch: py3.5 Changeset: r93561:85e44c9458db Date: 2017-12-25 22:02 +0200 http://bitbucket.org/pypy/pypy/changeset/85e44c9458db/ Log:fix for win32 diff --git a/pypy/module/errno/interp_errno.py b/pypy/module/errno/interp_errno.py --- a/pypy/module/errno/interp_errno.py +++ b/pypy/module/errno/interp_errno.py @@ -1,6 +1,7 @@ from rpython.rlib.objectmodel import not_rpython from rpython.rtyper.tool.rffi_platform import DefinedConstantInteger, configure from rpython.translator.tool.cbuild import ExternalCompilationInfo +import sys # from CPython 3.5 errors = [ @@ -40,7 +41,7 @@ "WSAEREMOTE", "WSAEINVAL", "WSAEINPROGRESS", "WSAGETSELECTEVEN", "WSAESOCKTNOSUPPORT", "WSAGETASYNCERRO", "WSAMAKESELECTREPL", "WSAGETASYNCBUFLE", "WSAEDESTADDRREQ", "WSAECONNREFUSED", "WSAENETRESET", -"WSAN",] +"WSAN", "WSAEDQUOT"] more_errors = [ "ENOMEDIUM", "EMEDIUMTYPE", "ECANCELED", "ENOKEY", "EKEYEXPIRED", @@ -55,10 +56,12 @@ "EFTYPE", "ENEEDAUTH", "ENOATTR", "ENOPOLICY", "EPROCLIM", "EPROCUNAVAIL", "EPROGMISMATCH", "EPROGUNAVAIL", "EPWROFF", "ERPCMISMATCH", "ESHLIBVERS"] - +includes = ['errno.h'] +if sys.platform == 'win32': +includes.append('winsock2.h') class CConfig: -_compilation_info_ = ExternalCompilationInfo(includes=['errno.h']) +_compilation_info_ = ExternalCompilationInfo(includes=includes) for err_name in errors + win_errors + more_errors: setattr(CConfig, err_name, DefinedConstantInteger(err_name)) @@ -77,7 +80,7 @@ assert name.startswith('WSA') code = config[name] if code is not None: -if name[3:] in errors: +if name[3:] in errors and name[3:] not in name2code: # errno.EFOO = name2code[name[3:]] = code # errno.WSABAR = ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix 248a5a9859ef (probably)
Author: Armin RigoBranch: py3.5 Changeset: r93560:36cb02a2cd90 Date: 2017-12-25 09:30 +0100 http://bitbucket.org/pypy/pypy/changeset/36cb02a2cd90/ Log:Fix 248a5a9859ef (probably) diff --git a/pypy/interpreter/timeutils.py b/pypy/interpreter/timeutils.py --- a/pypy/interpreter/timeutils.py +++ b/pypy/interpreter/timeutils.py @@ -4,6 +4,7 @@ import math from rpython.rlib.rarithmetic import ( r_longlong, ovfcheck, ovfcheck_float_to_longlong) +from rpython.rlib import rfloat from pypy.interpreter.error import oefmt SECS_TO_NS = 10 ** 9 @@ -21,6 +22,8 @@ def timestamp_w(space, w_secs): if space.isinstance_w(w_secs, space.w_float): secs = space.float_w(w_secs) +if rfloat.isnan(secs): +raise oefmt(space.w_ValueError, "timestamp is nan") result_float = math.ceil(secs * SECS_TO_NS) try: return ovfcheck_float_to_longlong(result_float) diff --git a/pypy/module/time/test/test_time.py b/pypy/module/time/test/test_time.py --- a/pypy/module/time/test/test_time.py +++ b/pypy/module/time/test/test_time.py @@ -13,12 +13,10 @@ assert isinstance(time._STRUCT_TM_ITEMS, int) def test_sleep(self): -import time, sys +import time raises(TypeError, time.sleep, "foo") time.sleep(0.12345) raises(ValueError, time.sleep, -1.0) -if sys.platform == 'win32': -assert False, 'hangs on win32 after translation' raises((ValueError, OverflowError), time.sleep, float('nan')) raises(OverflowError, time.sleep, float('inf')) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix for MSVC compatibility
Author: Matti PicusBranch: py3.5 Changeset: r93536:7dce5a70e8e7 Date: 2017-12-21 19:55 +0200 http://bitbucket.org/pypy/pypy/changeset/7dce5a70e8e7/ Log:fix for MSVC compatibility diff --git a/pypy/module/errno/interp_errno.py b/pypy/module/errno/interp_errno.py --- a/pypy/module/errno/interp_errno.py +++ b/pypy/module/errno/interp_errno.py @@ -58,7 +58,7 @@ class CConfig: -_compilation_info_ = ExternalCompilationInfo(includes=['sys/errno.h']) +_compilation_info_ = ExternalCompilationInfo(includes=['errno.h']) for err_name in errors + win_errors + more_errors: setattr(CConfig, err_name, DefinedConstantInteger(err_name)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation?
Author: Matti PicusBranch: py3.5 Changeset: r93526:0fda157e0d0e Date: 2017-12-21 07:15 +0200 http://bitbucket.org/pypy/pypy/changeset/0fda157e0d0e/ Log:fix translation? diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -204,7 +204,7 @@ if lastdirname: basename = '%s/%s' % (lastdirname, basename) self.co_filename = '/%s' % (basename,) -self.w_filename = space.newfilename(self.co_filename) +self.w_filename = self.space.newfilename(self.co_filename) co_names = property(lambda self: [self.space.str_w(w_name) for w_name in self.co_names_w]) # for trace ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix 'errors' arg in PyUnicode_Decode()
Author: Ronan LamyBranch: py3.5 Changeset: r93525:9ae4bd0c4555 Date: 2017-12-20 22:01 + http://bitbucket.org/pypy/pypy/changeset/9ae4bd0c4555/ Log:Fix 'errors' arg in PyUnicode_Decode() diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -631,8 +631,9 @@ def test_decode(self, space): b_text = rffi.str2charp('caf\x82xx') b_encoding = rffi.str2charp('cp437') -assert space.unicode_w( -PyUnicode_Decode(space, b_text, 4, b_encoding, None)) == u'caf\xe9' +b_errors = rffi.str2charp('strict') +assert space.unicode_w(PyUnicode_Decode( +space, b_text, 4, b_encoding, b_errors)) == u'caf\xe9' w_text = PyUnicode_FromEncodedObject(space, space.newbytes("test"), b_encoding, None) assert space.isinstance_w(w_text, space.w_unicode) diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -492,7 +492,7 @@ w_str = space.newbytes(rffi.charpsize2str(s, size)) w_encoding = space.newtext(rffi.charp2str(encoding)) if errors: -w_errors = space.newbytes(rffi.charp2str(errors)) +w_errors = space.newtext(rffi.charp2str(errors)) else: w_errors = None return space.call_method(w_str, 'decode', w_encoding, w_errors) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix for test_package. This might fix the next issue for "pypy3 -m ensurepip".
Author: Armin RigoBranch: py3.5 Changeset: r93519:5a865516f947 Date: 2017-12-20 17:01 +0100 http://bitbucket.org/pypy/pypy/changeset/5a865516f947/ Log:Fix for test_package. This might fix the next issue for "pypy3 -m ensurepip". diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py --- a/pypy/module/zipimport/interp_zipimport.py +++ b/pypy/module/zipimport/interp_zipimport.py @@ -252,6 +252,8 @@ gets in code_object.co_filename. Something like 'myfile.zip/mymodule.py' """ +if ZIPSEP != os.path.sep: +filename = filename.replace(ZIPSEP, os.path.sep) return self.filename + os.path.sep + filename def load_module(self, space, w_fullname): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix error reporting from posix.*xattr functions
Author: Ronan LamyBranch: py3.5 Changeset: r93517:0c9668c522b1 Date: 2017-12-20 14:01 + http://bitbucket.org/pypy/pypy/changeset/0c9668c522b1/ Log:Fix error reporting from posix.*xattr functions diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -2301,13 +2301,13 @@ try: result = rposix.fgetxattr(path.as_fd, attribute.as_bytes) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) else: try: result = rposix.getxattr(path.as_bytes, attribute.as_bytes, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) return space.newbytes(result) @unwrap_spec(path=path_or_fd(), attribute=path_or_fd(allow_fd=False), @@ -2330,13 +2330,13 @@ try: rposix.fsetxattr(path.as_fd, attribute.as_bytes, value) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) else: try: rposix.setxattr(path.as_bytes, attribute.as_bytes, value, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) @unwrap_spec(path=path_or_fd(), attribute=path_or_fd(allow_fd=False), @@ -2356,13 +2356,13 @@ try: rposix.fremovexattr(path.as_fd, attribute.as_bytes) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) else: try: rposix.removexattr(path.as_bytes, attribute.as_bytes, follow_symlinks=follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) +raise wrap_oserror(space, e, path.as_bytes) @unwrap_spec(path=path_or_fd(), follow_symlinks=bool) @@ -2388,9 +2388,8 @@ try: result = rposix.listxattr(path.as_bytes, follow_symlinks) except OSError as e: -raise wrap_oserror(space, e, eintr_retry=False) -return space.newlist([ -space.fsdecode(space.newbytes(attr)) for attr in result]) +raise wrap_oserror(space, e, path.as_bytes) +return space.newlist([space.newfilename(attr) for attr in result]) have_functions = [] diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -1448,7 +1448,8 @@ with open(self.path, 'wb'): pass init_names = os.listxattr(self.path) -raises(OSError, os.getxattr, self.path, 'user.test') +excinfo = raises(OSError, os.getxattr, self.path, 'user.test') +assert excinfo.value.filename == self.path os.setxattr(self.path, 'user.test', b'', os.XATTR_CREATE, follow_symlinks=False) assert os.getxattr(self.path, 'user.test') == b'' os.setxattr(self.path, b'user.test', b'foo', os.XATTR_REPLACE) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Armin RigoBranch: py3.5 Changeset: r93514:1dd2914caff4 Date: 2017-12-20 14:31 +0100 http://bitbucket.org/pypy/pypy/changeset/1dd2914caff4/ Log:fix test diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -769,9 +769,9 @@ class TestAbi: def test_abi_tag(self): -space1 = maketestobjspace(make_config(None, soabi='TEST')) +space1 = maketestobjspace(make_config(None, soabi='footest')) space2 = maketestobjspace(make_config(None, soabi='')) -assert importing.get_so_extension(space1).startswith('.TEST') +assert importing.get_so_extension(space1).startswith('.footest') if sys.platform == 'win32': assert importing.get_so_extension(space2) == '.pyd' else: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix for non-win32
Author: Matti PicusBranch: py3.5 Changeset: r93479:75cccb748415 Date: 2017-12-18 22:08 +0200 http://bitbucket.org/pypy/pypy/changeset/75cccb748415/ Log:fix for non-win32 diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py b/lib_pypy/_cffi_ssl/_stdssl/__init__.py --- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py +++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py @@ -27,6 +27,7 @@ HAVE_POLL = False else: from select import poll, POLLIN, POLLOUT +HAVE_POLL = True OPENSSL_VERSION = ffi.string(lib.OPENSSL_VERSION_TEXT).decode('utf-8') OPENSSL_VERSION_NUMBER = lib.OPENSSL_VERSION_NUMBER ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test_gr_frame in test_greenlet.py
Author: Ronan LamyBranch: py3.5 Changeset: r93453:cf79d090d371 Date: 2017-12-17 22:07 + http://bitbucket.org/pypy/pypy/changeset/cf79d090d371/ Log:Fix test_gr_frame in test_greenlet.py diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py --- a/lib_pypy/greenlet.py +++ b/lib_pypy/greenlet.py @@ -127,7 +127,7 @@ return None if self.__main: self = getcurrent() -f = _continulet.__reduce__(self)[2][0] +f = self._get_frame() if not f: return None return f.f_back.f_back.f_back # go past start(), __switch(), switch() diff --git a/pypy/module/_continuation/interp_continuation.py b/pypy/module/_continuation/interp_continuation.py --- a/pypy/module/_continuation/interp_continuation.py +++ b/pypy/module/_continuation/interp_continuation.py @@ -131,6 +131,15 @@ from pypy.module._continuation import interp_pickle interp_pickle.setstate(self, w_args) +def descr_get_frame(self, space): +if self.sthread is None: +w_frame = space.w_False +elif self.sthread.is_empty_handle(self.h): +w_frame = space.w_None +else: +w_frame = self.bottomframe +return w_frame + def W_Continulet___new__(space, w_subtype, __args__): r = space.allocate_instance(W_Continulet, w_subtype) @@ -153,6 +162,7 @@ is_pending = interp2app(W_Continulet.descr_is_pending), __reduce__ = interp2app(W_Continulet.descr__reduce__), __setstate__= interp2app(W_Continulet.descr__setstate__), +_get_frame=interp2app(W_Continulet.descr_get_frame) ) # diff --git a/pypy/module/_continuation/interp_pickle.py b/pypy/module/_continuation/interp_pickle.py --- a/pypy/module/_continuation/interp_pickle.py +++ b/pypy/module/_continuation/interp_pickle.py @@ -18,12 +18,7 @@ # __getnewargs__ or __getstate__ defined in the subclass, etc. # Doing the right thing looks involved, though... space = self.space -if self.sthread is None: -w_frame = space.w_False -elif self.sthread.is_empty_handle(self.h): -w_frame = space.w_None -else: -w_frame = self.bottomframe +w_frame = self.descr_get_frame(space) w_continulet_type = space.type(self) w_dict = self.getdict(space) or space.w_None args = [getunpickle(space), ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r93451:b1f6c07626d3 Date: 2017-12-17 21:23 + http://bitbucket.org/pypy/pypy/changeset/b1f6c07626d3/ Log:fix translation diff --git a/pypy/module/_continuation/interp_pickle.py b/pypy/module/_continuation/interp_pickle.py --- a/pypy/module/_continuation/interp_pickle.py +++ b/pypy/module/_continuation/interp_pickle.py @@ -2,10 +2,9 @@ from rpython.rlib import jit from pypy.interpreter.error import OperationError from pypy.interpreter.pyframe import PyFrame -from pypy.module._continuation.interp_continuation import State, global_state -from pypy.module._continuation.interp_continuation import build_sthread -from pypy.module._continuation.interp_continuation import post_switch -from pypy.module._continuation.interp_continuation import get_result, geterror +from pypy.module._continuation.interp_continuation import ( +State, global_state, build_sthread, pre_switch, post_switch, +get_result, geterror) def getunpickle(space): @@ -65,9 +64,10 @@ if self.bottomframe is None: w_result = space.w_None else: +saved_exception = pre_switch(sthread) h = sthread.switch(self.h) try: -w_result = post_switch(sthread, h) +w_result = post_switch(sthread, h, saved_exception) operr = None except OperationError as e: w_result = None ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix 2 tests
Author: Ronan LamyBranch: py3.5 Changeset: r93450:413ffdce2e44 Date: 2017-12-17 15:03 + http://bitbucket.org/pypy/pypy/changeset/413ffdce2e44/ Log:fix 2 tests diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -66,10 +66,12 @@ guard_not_invalidated(descr=...) p109 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i5, descr=) guard_no_exception(descr=...) -guard_nonnull(p109, descr=...) -p10 = call_r(ConstClass(ll_str2unicode__rpy_stringPtr), p109, descr=) +i80 = strlen(p109) +p86 = call_r(ConstClass(str_decode_utf_8), p109, i80, ConstPtr(ptr82), 1, ConstClass(raise_unicode_exception_decode), 1, descr=) guard_no_exception(descr=...) +p10 = getfield_gc_r(p86, descr=) guard_nonnull(p10, descr=...) + i99 = unicodehash(p10) # NOTE: with siphash24, notably on unicodes, computing the hash # may raise MemoryError diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -116,10 +116,7 @@ p97 = call_r(ConstClass(_rpy_unicode_to_decimal_w), p25, descr=) guard_no_exception(descr=...) i98 = unicodelen(p97) -p99 = force_token() -setfield_gc(p0, p99, descr=) -p104 = call_may_force_r(ConstClass(unicode_encode_utf_8_impl), p97, i98, ConstPtr(ptr101), 1, 1, descr=) -guard_not_forced(descr=...) +p104 = call_r(ConstClass(unicode_encode_utf_8), p97, i98, ConstPtr(ptr94), 1, descr=) guard_no_exception(descr=...) i107 = call_i(ConstClass(string_to_int), p104, 16, descr=) guard_no_exception(descr=...) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93447:ea2056d81509 Date: 2017-12-16 07:08 + http://bitbucket.org/pypy/pypy/changeset/ea2056d81509/ Log:fix test diff --git a/pypy/module/_cppyy/test/test_datatypes.py b/pypy/module/_cppyy/test/test_datatypes.py --- a/pypy/module/_cppyy/test/test_datatypes.py +++ b/pypy/module/_cppyy/test/test_datatypes.py @@ -100,8 +100,9 @@ # can not access an instance member on the class raises(AttributeError, getattr, CppyyTestData, 'm_bool') raises(AttributeError, getattr, CppyyTestData, 'm_int') -raises(ReferenceError, hasattr, CppyyTestData, 'm_bool') -raises(ReferenceError, hasattr, CppyyTestData, 'm_int') + +assert not hasattr(CppyyTestData, 'm_bool') +assert not hasattr(CppyyTestData, 'm_int') c.__destruct__() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix AppTestWriteBytecode tests
Author: Ronan LamyBranch: py3.5 Changeset: r93436:71a2dd4b2fa2 Date: 2017-12-16 04:38 + http://bitbucket.org/pypy/pypy/changeset/71a2dd4b2fa2/ Log:fix AppTestWriteBytecode tests diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -1210,12 +1210,12 @@ } def setup_class(cls): -cls.saved_modules = _setup(cls) +cls.w_saved_modules = _setup(cls) sandbox = cls.spaceconfig['translation.sandbox'] cls.w_sandbox = cls.space.wrap(sandbox) def teardown_class(cls): -_teardown(cls.space, cls.saved_modules) +_teardown(cls.space, cls.w_saved_modules) cls.space.appexec([], """ (): import sys @@ -1245,6 +1245,7 @@ assert not os.path.exists(c.__cached__) +@pytest.mark.skipif('config.option.runappdirect') class AppTestWriteBytecodeSandbox(AppTestWriteBytecode): spaceconfig = { "translation.sandbox": True ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test_stacklet
Author: Ronan LamyBranch: py3.5 Changeset: r93434:bfa08194d964 Date: 2017-12-16 03:27 + http://bitbucket.org/pypy/pypy/changeset/bfa08194d964/ Log:fix test_stacklet diff --git a/pypy/module/_continuation/test/support.py b/pypy/module/_continuation/test/support.py --- a/pypy/module/_continuation/test/support.py +++ b/pypy/module/_continuation/test/support.py @@ -10,4 +10,3 @@ import rpython.rlib.rstacklet except CompilationError as e: py.test.skip("cannot import rstacklet: %s" % e) - diff --git a/pypy/module/_continuation/test/test_stacklet.py b/pypy/module/_continuation/test/test_stacklet.py --- a/pypy/module/_continuation/test/test_stacklet.py +++ b/pypy/module/_continuation/test/test_stacklet.py @@ -23,7 +23,7 @@ # frame cycle res.append('...') break -if f.f_code.co_name == 'runtest': +if f.f_code.co_name == '': # if we are running with -A, cut all the stack above # the test function break @@ -34,9 +34,6 @@ return res return stack """) -if cls.runappdirect: -# make sure that "self.stack" does not pass the self -cls.w_stack = staticmethod(cls.w_stack.im_func) def test_new_empty(self): from _continuation import continulet ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix handling of time.sleep()'s argument and use nanosecond precision internally
Author: Ronan LamyBranch: py3.5 Changeset: r93425:570c2749ff19 Date: 2017-12-15 04:22 + http://bitbucket.org/pypy/pypy/changeset/570c2749ff19/ Log:Fix handling of time.sleep()'s argument and use nanosecond precision internally diff --git a/pypy/interpreter/timeutils.py b/pypy/interpreter/timeutils.py --- a/pypy/interpreter/timeutils.py +++ b/pypy/interpreter/timeutils.py @@ -1,6 +1,14 @@ """ Access to the time module's high-resolution monotonic clock """ +import math +from rpython.rlib.rarithmetic import ( +r_longlong, ovfcheck, ovfcheck_float_to_longlong) +from pypy.interpreter.error import oefmt + +SECS_TO_NS = 10 ** 9 +MS_TO_NS = 10 ** 6 +US_TO_NS = 10 ** 3 def monotonic(space): from pypy.module.time import interp_time @@ -9,3 +17,21 @@ else: w_res = interp_time.gettimeofday(space) return space.float_w(w_res) # xxx back and forth + +def timestamp_w(space, w_secs): +if space.isinstance_w(w_secs, space.w_float): +secs = space.float_w(w_secs) +result_float = math.ceil(secs * SECS_TO_NS) +try: +return ovfcheck_float_to_longlong(result_float) +except OverflowError: +raise oefmt(space.w_OverflowError, +"timestamp %R too large to convert to C _PyTime_t", w_secs) +else: +sec = space.int_w(w_secs) +try: +result = ovfcheck(sec * SECS_TO_NS) +except OverflowError: +raise oefmt(space.w_OverflowError, +"timestamp too large to convert to C _PyTime_t") +return r_longlong(result) diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py --- a/pypy/module/time/interp_time.py +++ b/pypy/module/time/interp_time.py @@ -3,10 +3,12 @@ from pypy.interpreter.error import (OperationError, oefmt, strerror as _strerror, exception_from_saved_errno) from pypy.interpreter.gateway import unwrap_spec -from pypy.interpreter import timeutils +from pypy.interpreter.timeutils import ( +SECS_TO_NS, MS_TO_NS, US_TO_NS, monotonic as _monotonic, timestamp_w) from pypy.interpreter.unicodehelper import decode_utf8, encode_utf8 from rpython.rtyper.lltypesystem import lltype -from rpython.rlib.rarithmetic import intmask, r_ulonglong, r_longfloat, widen +from rpython.rlib.rarithmetic import ( +intmask, r_ulonglong, r_longfloat, widen, ovfcheck, ovfcheck_float_to_int) from rpython.rlib.rtime import (GETTIMEOFDAY_NO_TZ, TIMEVAL, HAVE_GETTIMEOFDAY, HAVE_FTIME) from rpython.rlib import rposix, rtime @@ -452,25 +454,22 @@ from rpython.rlib.rtime import c_select from rpython.rlib import rwin32 -@unwrap_spec(secs=float) -def sleep(space, secs): -if secs < 0: +def sleep(space, w_secs): +ns = timestamp_w(space, w_secs) +if not (ns >= 0): raise oefmt(space.w_ValueError, "sleep length must be non-negative") -end_time = timeutils.monotonic(space) + secs +end_time = _monotonic(space) + float(ns) / SECS_TO_NS while True: if _WIN: # as decreed by Guido, only the main thread can be # interrupted. main_thread = space.fromcache(State).main_thread interruptible = (main_thread == thread.get_ident()) -millisecs = int(secs * 1000) +millisecs = ns // MS_TO_NS if millisecs == 0 or not interruptible: -rtime.sleep(secs) +rtime.sleep(float(ns) / SECS_TO_NS) break -MAX = int(sys.maxint / 1000) # > 24 days -if millisecs > MAX: -millisecs = MAX interrupt_event = space.fromcache(State).get_interrupt_event() rwin32.ResetEvent(interrupt_event) rc = rwin32.WaitForSingleObject(interrupt_event, millisecs) @@ -479,9 +478,10 @@ else: void = lltype.nullptr(rffi.VOIDP.TO) with lltype.scoped_alloc(TIMEVAL) as t: -frac = math.fmod(secs, 1.0) -rffi.setintfield(t, 'c_tv_sec', int(secs)) -rffi.setintfield(t, 'c_tv_usec', int(frac*100.0)) +seconds = ns // SECS_TO_NS +us = (ns % SECS_TO_NS) // US_TO_NS +rffi.setintfield(t, 'c_tv_sec', seconds) +rffi.setintfield(t, 'c_tv_usec', us) res = rffi.cast(rffi.LONG, c_select(0, void, void, void, t)) if res == 0: @@ -489,8 +489,8 @@ if rposix.get_saved_errno() != EINTR: raise exception_from_saved_errno(space, space.w_OSError) space.getexecutioncontext().checksignals() -secs = end_time - timeutils.monotonic(space) # retry -if secs <= 0.0: +secs = end_time - _monotonic(space) # retry +if secs <= 0: break def _get_module_object(space, obj_name): diff --git a/pypy/module/time/test/test_time.py
[pypy-commit] pypy py3.5: Fix handling of unencodable strings in ModuleDictStrategy
Author: Ronan LamyBranch: py3.5 Changeset: r93422:da0e3f790bdb Date: 2017-12-14 19:29 + http://bitbucket.org/pypy/pypy/changeset/da0e3f790bdb/ Log:Fix handling of unencodable strings in ModuleDictStrategy diff --git a/pypy/objspace/std/celldict.py b/pypy/objspace/std/celldict.py --- a/pypy/objspace/std/celldict.py +++ b/pypy/objspace/std/celldict.py @@ -6,6 +6,7 @@ from rpython.rlib import jit, rerased, objectmodel from pypy.interpreter.baseobjspace import W_Root +from pypy.interpreter.error import OperationError from pypy.objspace.std.dictmultiobject import ( DictStrategy, ObjectDictStrategy, _never_equal_to_string, create_iterator_classes) @@ -54,10 +55,21 @@ def _getdictvalue_no_unwrapping_pure(self, version, w_dict, key): return self.unerase(w_dict.dstorage).get(key, None) +def try_unwrap_key(self, space, w_key): +if space.is_w(space.type(w_key), space.w_text): +try: +return space.text_w(w_key) +except OperationError as e: +if e.match(space, space.w_UnicodeEncodeError): +return None +raise +return None + def setitem(self, w_dict, w_key, w_value): space = self.space -if space.is_w(space.type(w_key), space.w_text): -self.setitem_str(w_dict, space.text_w(w_key), w_value) +key = self.try_unwrap_key(space, w_key) +if key is not None: +self.setitem_str(w_dict, key, w_value) else: self.switch_to_object_strategy(w_dict) w_dict.setitem(w_key, w_value) @@ -75,8 +87,8 @@ def setdefault(self, w_dict, w_key, w_default): space = self.space -if space.is_w(space.type(w_key), space.w_text): -key = space.text_w(w_key) +key = self.try_unwrap_key(space, w_key) +if key is not None: cell = self.getdictvalue_no_unwrapping(w_dict, key) w_result = unwrap_cell(self.space, cell) if w_result is not None: @@ -90,8 +102,8 @@ def delitem(self, w_dict, w_key): space = self.space w_key_type = space.type(w_key) -if space.is_w(w_key_type, space.w_text): -key = space.text_w(w_key) +key = self.try_unwrap_key(space, w_key) +if key is not None: dict_w = self.unerase(w_dict.dstorage) try: del dict_w[key] @@ -111,9 +123,9 @@ def getitem(self, w_dict, w_key): space = self.space w_lookup_type = space.type(w_key) -if space.is_w(w_lookup_type, space.w_text): -return self.getitem_str(w_dict, space.text_w(w_key)) - +key = self.try_unwrap_key(space, w_key) +if key is not None: +return self.getitem_str(w_dict, key) elif _never_equal_to_string(space, w_lookup_type): return None else: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93299:0451e5fe8470 Date: 2017-12-07 04:34 + http://bitbucket.org/pypy/pypy/changeset/0451e5fe8470/ Log:fix test diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -466,8 +466,8 @@ def test_encode_utf8(self, space): u = rffi.unicode2wcharp(u'sp\x09m') -w_s = PyUnicode_EncodeUTF8(space, u, 4, None) -assert space.unicode_w(w_s) == u'sp\x09m'.encode('utf-8') +w_b = PyUnicode_EncodeUTF8(space, u, 4, None) +assert space.bytes_w(w_b) == u'sp\x09m'.encode('utf-8') rffi.free_wcharp(u) def test_encode_decimal(self, space): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93260:6025539c2c58 Date: 2017-12-03 19:59 + http://bitbucket.org/pypy/pypy/changeset/6025539c2c58/ Log:fix test diff --git a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py --- a/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py +++ b/pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py @@ -51,10 +51,12 @@ # do not care for _optimize_charset or _mk_bitmap continue assert loop.count > 0 -if ' is_prime, ' in loop.comment: +if 'is_prime' in loop.comment: is_prime_loops.append(loop) -elif ' fn_with_bridges, ' in loop.comment: +elif 'fn_with_bridges' in loop.comment: fn_with_bridges_loops.append(loop) +elif 'tuple.contains' in loop.comment: +pass else: assert ' bridge ' in loop.comment key = mangle_descr(loop.descr) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix bad merge
Author: Ronan LamyBranch: py3.5 Changeset: r93258:7f17056199b6 Date: 2017-12-03 18:44 + http://bitbucket.org/pypy/pypy/changeset/7f17056199b6/ Log:fix bad merge diff --git a/pypy/module/thread/test/test_import_lock.py b/pypy/module/thread/test/test_import_lock.py --- a/pypy/module/thread/test/test_import_lock.py +++ b/pypy/module/thread/test/test_import_lock.py @@ -101,8 +101,8 @@ importhook(space, 'sys') assert importlock.count == 0 # A new module -importhook(space, 're') -assert importlock.count >= 9 +importhook(space, 'time') +assert importlock.count >= 1 # Import it again previous_count = importlock.count importhook(space, "time") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test: pick an obscure module that won't have been imported yet
Author: Ronan LamyBranch: py3.5 Changeset: r93257:5afa98675f99 Date: 2017-12-03 18:37 + http://bitbucket.org/pypy/pypy/changeset/5afa98675f99/ Log:Fix test: pick an obscure module that won't have been imported yet diff --git a/pypy/module/cpyext/test/test_import.py b/pypy/module/cpyext/test/test_import.py --- a/pypy/module/cpyext/test/test_import.py +++ b/pypy/module/cpyext/test/test_import.py @@ -22,7 +22,7 @@ space.wrap('__name__'))) == 'foobar' def test_getmoduledict(self, space, api): -testmod = "contextlib" +testmod = "imghdr" w_pre_dict = PyImport_GetModuleDict(space, ) assert not space.contains_w(w_pre_dict, space.wrap(testmod)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93256:18ca07086209 Date: 2017-12-03 18:22 + http://bitbucket.org/pypy/pypy/changeset/18ca07086209/ Log:fix test diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -340,7 +340,6 @@ #if defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4) const wchar_t wtext[2] = {(wchar_t)0x10ABCDu}; size_t wtextlen = 1; -const wchar_t invalid[1] = {(wchar_t)0x11u}; #else const wchar_t wtext[3] = {(wchar_t)0xDBEAu, (wchar_t)0xDFCDu}; size_t wtextlen = 2; ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix rffi nonsense
Author: Ronan LamyBranch: py3.5 Changeset: r93240:9847200316ed Date: 2017-12-02 05:09 + http://bitbucket.org/pypy/pypy/changeset/9847200316ed/ Log:fix rffi nonsense diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -700,8 +700,8 @@ value = 1 else: value = 0 -pendian = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') -pendian[0] = rffi.cast(rffi.INT, value) +pendian = lltype.malloc(INT_realP.TO, 1, flavor='raw') +pendian[0] = rffi.cast(rffi.INT_real, value) else: pendian = None @@ -736,8 +736,8 @@ value = 1 else: value = 0 -pendian = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') -pendian[0] = rffi.cast(rffi.INT, value) +pendian = lltype.malloc(INT_realP.TO, 1, flavor='raw') +pendian[0] = rffi.cast(rffi.INT_real, value) else: pendian = None ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix tests
Author: Ronan LamyBranch: py3.5 Changeset: r93239:13acefc43cbf Date: 2017-12-02 04:54 + http://bitbucket.org/pypy/pypy/changeset/13acefc43cbf/ Log:fix tests diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -504,9 +504,9 @@ def test_encode_fsdefault(self, space): w_u = space.wrap(u'spm') -w_s = PyUnicode_EncodeFSDefault(space, w_u) -if w_s is None: -PyErr_Clear(space) +try: +w_s = PyUnicode_EncodeFSDefault(space, w_u) +except OperationError: py.test.skip("Requires a unicode-aware fsencoding") with rffi.scoped_str2charp(space.str_w(w_s)) as encoded: w_decoded = PyUnicode_DecodeFSDefaultAndSize(space, encoded, space.len_w(w_s)) @@ -623,8 +623,11 @@ def test_fromobject(self, space): w_u = space.wrap(u'a') assert PyUnicode_FromObject(space, w_u) is w_u -assert space.unwrap( -PyUnicode_FromObject(space, space.newbytes('test'))) == "b'test'" +with raises_w(space, TypeError): +PyUnicode_FromObject(space, space.newbytes('test')) +with raises_w(space, TypeError): +PyUnicode_FromObject(space, space.newint(42)) + def test_decode(self, space): b_text = rffi.str2charp('caf\x82xx') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix test
Author: Ronan LamyBranch: py3.5 Changeset: r93238:c31995f66da2 Date: 2017-12-02 04:40 + http://bitbucket.org/pypy/pypy/changeset/c31995f66da2/ Log:fix test diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -454,6 +454,7 @@ assert module.tp_descr_set(p) is True def test_text_signature(self): +import sys module = self.import_module(name='docstrings') assert module.SomeType.__text_signature__ == '()' assert module.SomeType.__doc__ == 'A type with a signature' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix: StringIO.seek() may set the position beyond the end of the buffer
Author: Ronan LamyBranch: py3.5 Changeset: r93236:981544a8f028 Date: 2017-12-02 03:12 + http://bitbucket.org/pypy/pypy/changeset/981544a8f028/ Log:fix: StringIO.seek() may set the position beyond the end of the buffer diff --git a/pypy/module/_io/interp_stringio.py b/pypy/module/_io/interp_stringio.py --- a/pypy/module/_io/interp_stringio.py +++ b/pypy/module/_io/interp_stringio.py @@ -35,7 +35,8 @@ def _convert_limit(self, limit): if limit < 0 or limit > len(self.data) - self.pos: limit = len(self.data) - self.pos -assert limit >= 0 +if limit < 0: # happens when self.pos > len(self.data) +limit = 0 return limit def readline_universal(self, limit): diff --git a/pypy/module/_io/test/test_stringio.py b/pypy/module/_io/test/test_stringio.py --- a/pypy/module/_io/test/test_stringio.py +++ b/pypy/module/_io/test/test_stringio.py @@ -259,6 +259,8 @@ assert line == s i += 1 assert i == 10 +sio.seek(len(s) * 10 +1) +assert list(sio) == [] sio = io.StringIO(s * 2) sio.close() raises(ValueError, next, sio) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix handling of arguments containing null bytes in zipimporter methods
Author: Ronan LamyBranch: py3.5 Changeset: r93235:e6985c577de2 Date: 2017-12-01 21:16 + http://bitbucket.org/pypy/pypy/changeset/e6985c577de2/ Log:Fix handling of arguments containing null bytes in zipimporter methods diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py --- a/pypy/module/imp/importing.py +++ b/pypy/module/imp/importing.py @@ -292,7 +292,7 @@ ext + PYC_TAG + '.pyc') return result -#@signature(types.str0(), returns=types.str0()) +@signature(types.str0(), returns=types.any()) def make_source_pathname(pathname): "Given the path to a .pyc file, return the path to its .py file." # (...)/__pycache__/foo..pyc -> (...)/foo.py diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py --- a/pypy/module/zipimport/interp_zipimport.py +++ b/pypy/module/zipimport/interp_zipimport.py @@ -1,6 +1,15 @@ import os import stat +from rpython.annotator.model import s_Str0 +from rpython.rlib.objectmodel import enforceargs +from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.rzipfile import RZipFile, BadZipfile +from rpython.rlib.rzlib import RZlibError +from rpython.rlib.rstring import assert_str0 +from rpython.rlib.signature import signature, finishsigs +from rpython.rlib import types + from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.error import OperationError, oefmt from pypy.interpreter.gateway import interp2app, unwrap_spec @@ -8,9 +17,6 @@ from pypy.interpreter.module import Module from pypy.module.imp import importing from pypy.module.zlib.interp_zlib import zlib_error -from rpython.rlib.unroll import unrolling_iterable -from rpython.rlib.rzipfile import RZipFile, BadZipfile -from rpython.rlib.rzlib import RZlibError ZIPSEP = '/' # note that zipfiles always use slash, but for OSes with other @@ -116,6 +122,7 @@ zip_cache = W_ZipCache() +@finishsigs class W_ZipImporter(W_Root): def __init__(self, space, name, filename, zip_file, prefix): self.space = space @@ -138,12 +145,14 @@ filename = filename.replace(os.path.sep, ZIPSEP) return filename +@signature(types.self(), types.str0(), returns=types.str0()) def corr_zname(self, fname): if ZIPSEP != os.path.sep: return fname.replace(ZIPSEP, os.path.sep) else: return fname +@enforceargs(filename=s_Str0, typecheck=False) def import_py_file(self, space, modname, filename, buf, pkgpath): w_mod = Module(space, space.newtext(modname)) real_name = self.filename + os.path.sep + self.corr_zname(filename) @@ -194,20 +203,21 @@ return False return True +@enforceargs(filename=s_Str0, typecheck=False) def import_pyc_file(self, space, modname, filename, buf, pkgpath): magic = importing._get_long(buf[:4]) timestamp = importing._get_long(buf[4:8]) if not self.can_use_pyc(space, filename, magic, timestamp): return None # zipimport ignores the size field -buf = buf[12:] # XXX ugly copy, should use sequential read instead +buf = buf[12:] # XXX ugly copy, should use sequential read instead w_mod = Module(space, space.newtext(modname)) real_name = self.filename + os.path.sep + self.corr_zname(filename) space.setattr(w_mod, space.newtext('__loader__'), self) importing._prepare_module(space, w_mod, real_name, pkgpath) -result = importing.load_compiled_module(space, space.newtext(modname), w_mod, -real_name, magic, timestamp, -buf) +result = importing.load_compiled_module( +space, space.newtext(modname), +w_mod, real_name, magic, timestamp, buf) return result def have_modulefile(self, space, filename): @@ -227,14 +237,14 @@ return self def make_filename(self, fullname): -startpos = fullname.rfind('.') + 1 # 0 when not found +startpos = fullname.rfind('.') + 1 # 0 when not found assert startpos >= 0 subname = fullname[startpos:] if ZIPSEP == os.path.sep: return self.prefix + subname.replace('.', '/') else: -return self.prefix.replace(os.path.sep, ZIPSEP) + \ -subname.replace('.', '/') +return (self.prefix.replace(os.path.sep, ZIPSEP) + +subname.replace('.', '/')) def make_co_filename(self, filename): """ @@ -248,6 +258,12 @@ fullname = space.text_w(w_fullname) filename = self.make_filename(fullname) for compiled, is_package, ext in ENUMERATE_EXTS: +if '\x00' in filename: +# Special case to make the annotator happy: +# filenames inside ZIPs shouldn't
[pypy-commit] pypy py3.5: Fix traceback.print_exception() when exc.offset == 0
Author: Ronan LamyBranch: py3.5 Changeset: r93117:e37a09d8450a Date: 2017-11-21 18:38 + http://bitbucket.org/pypy/pypy/changeset/e37a09d8450a/ Log:Fix traceback.print_exception() when exc.offset == 0 diff --git a/lib-python/3/traceback.py b/lib-python/3/traceback.py --- a/lib-python/3/traceback.py +++ b/lib-python/3/traceback.py @@ -544,8 +544,8 @@ yield '{}\n'.format(badline.strip()) if offset is not None: caretspace = badline.rstrip('\n') -offset = min(len(caretspace), offset) - 1 -caretspace = caretspace[:offset].lstrip() +# bug in CPython: the case offset==0 is mishandled +caretspace = caretspace[:offset].lstrip()[:-1] # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) yield '{}^\n'.format(''.join(caretspace)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix tests to match PyPy behaviour
Author: Ronan LamyBranch: py3.5 Changeset: r93104:5c2561dd0c89 Date: 2017-11-20 19:06 + http://bitbucket.org/pypy/pypy/changeset/5c2561dd0c89/ Log:Fix tests to match PyPy behaviour diff --git a/lib-python/3/test/test_pydoc.py b/lib-python/3/test/test_pydoc.py --- a/lib-python/3/test/test_pydoc.py +++ b/lib-python/3/test/test_pydoc.py @@ -141,7 +141,7 @@ Modules - +\x20\x20\x20\x20 builtins @@ -878,7 +878,7 @@ @requires_docstrings def test_unbound_builtin_method(self): self.assertEqual(self._get_summary_line(pickle.Pickler.dump), -"dump(self, obj, /)") +"dump(self, obj)") # these no longer include "self" def test_bound_python_method(self): @@ -891,13 +891,13 @@ s = StringIO() p = pickle.Pickler(s) self.assertEqual(self._get_summary_line(p.dump), -"dump(obj, /) method of _pickle.Pickler instance") +"dump(obj) method of pickle._Pickler instance") # this should *never* include self! @requires_docstrings def test_module_level_callable(self): self.assertEqual(self._get_summary_line(os.stat), -"stat(path, *, dir_fd=None, follow_symlinks=True)") +"stat(path, *, dir_fd=-100, follow_symlinks=True)") @unittest.skipUnless(threading, 'Threading required for this test.') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix doctest to work on builtin functions and methods
Author: Ronan LamyBranch: py3.5 Changeset: r93074:ab4627e038e3 Date: 2017-11-17 19:22 + http://bitbucket.org/pypy/pypy/changeset/ab4627e038e3/ Log:Fix doctest to work on builtin functions and methods diff --git a/lib-python/3/doctest.py b/lib-python/3/doctest.py --- a/lib-python/3/doctest.py +++ b/lib-python/3/doctest.py @@ -939,6 +939,8 @@ elif inspect.getmodule(object) is not None: return module is inspect.getmodule(object) elif inspect.isfunction(object): +if isinstance(object.__code__, inspect._builtin_code_type): +return True # XXX: A PyPy builtin - no way to tell return module.__dict__ is object.__globals__ elif inspect.ismethoddescriptor(object): if hasattr(object, '__objclass__'): diff --git a/lib-python/3/test/test_doctest.py b/lib-python/3/test/test_doctest.py --- a/lib-python/3/test/test_doctest.py +++ b/lib-python/3/test/test_doctest.py @@ -660,7 +660,7 @@ >>> import builtins >>> tests = doctest.DocTestFinder().find(builtins) ->>> lo, hi = (120, 140) if is_pypy else (790, 810) +>>> lo, hi = (420, 440) if is_pypy else (790, 810) >>> lo < len(tests) < hi # approximate number of objects with docstrings True >>> real_tests = [t for t in tests if len(t.examples) > 0] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix did test to match PyPy bytecode
Author: Ronan LamyBranch: py3.5 Changeset: r93072:4f9bca50104e Date: 2017-11-17 17:32 + http://bitbucket.org/pypy/pypy/changeset/4f9bca50104e/ Log:Fix did test to match PyPy bytecode diff --git a/lib-python/3/test/test_dis.py b/lib-python/3/test/test_dis.py --- a/lib-python/3/test/test_dis.py +++ b/lib-python/3/test/test_dis.py @@ -147,23 +147,24 @@ pass dis_bug1333982 = """\ -%3d 0 LOAD_CONST 1 (0) - 3 POP_JUMP_IF_TRUE35 - 6 LOAD_GLOBAL 0 (AssertionError) - 9 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) - 12 LOAD_CONST 3 ('bug1333982..') - 15 MAKE_FUNCTION0 - 18 LOAD_FAST0 (x) - 21 GET_ITER - 22 CALL_FUNCTION1 (1 positional, 0 keyword pair) +%3d 0 JUMP_IF_NOT_DEBUG 35 (to 38) + 3 LOAD_CONST 1 (0) + 6 POP_JUMP_IF_TRUE38 + 9 LOAD_GLOBAL 0 (AssertionError) + 12 LOAD_CONST 2 ( at 0x..., file "%s", line %d>) + 15 LOAD_CONST 3 ('bug1333982..') + 18 MAKE_FUNCTION0 + 21 LOAD_FAST0 (x) + 24 GET_ITER + 25 CALL_FUNCTION1 (1 positional, 0 keyword pair) -%3d 25 LOAD_CONST 4 (1) - 28 BINARY_ADD - 29 CALL_FUNCTION1 (1 positional, 0 keyword pair) - 32 RAISE_VARARGS1 +%3d 28 LOAD_CONST 4 (1) + 31 BINARY_ADD + 32 CALL_FUNCTION1 (1 positional, 0 keyword pair) + 35 RAISE_VARARGS1 -%3d >> 35 LOAD_CONST 0 (None) - 38 RETURN_VALUE +%3d >> 38 LOAD_CONST 0 (None) + 41 RETURN_VALUE """ % (bug1333982.__code__.co_firstlineno + 1, __file__, bug1333982.__code__.co_firstlineno + 1, ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test to work on PyPy
Author: Ronan LamyBranch: py3.5 Changeset: r93043:12f1fb4860ac Date: 2017-11-15 16:23 + http://bitbucket.org/pypy/pypy/changeset/12f1fb4860ac/ Log:Fix test to work on PyPy diff --git a/lib-python/3/test/test_inspect.py b/lib-python/3/test/test_inspect.py --- a/lib-python/3/test/test_inspect.py +++ b/lib-python/3/test/test_inspect.py @@ -765,12 +765,15 @@ self.assertFullArgSpecEquals(_pickle.Pickler(io.BytesIO()).dump, args_e=['self', 'obj'], formatted='(self, obj)') +# platform-dependent on PyPy +default_fd = os.stat.__kwdefaults__['dir_fd'] + self.assertFullArgSpecEquals( os.stat, args_e=['path'], kwonlyargs_e=['dir_fd', 'follow_symlinks'], - kwonlydefaults_e={'dir_fd': None, 'follow_symlinks': True}, - formatted='(path, *, dir_fd=None, follow_symlinks=True)') + kwonlydefaults_e={'dir_fd': default_fd, 'follow_symlinks': True}, + formatted='(path, *, dir_fd={}, follow_symlinks=True)'.format(default_fd)) @unittest.skipIf(MISSING_C_DOCSTRINGS, "Signature information for builtins requires docstrings") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix
Author: Ronan LamyBranch: py3.5 Changeset: r93024:bf4ed8da1af1 Date: 2017-11-14 23:09 + http://bitbucket.org/pypy/pypy/changeset/bf4ed8da1af1/ Log:fix diff --git a/pypy/module/cpyext/memoryobject.py b/pypy/module/cpyext/memoryobject.py --- a/pypy/module/cpyext/memoryobject.py +++ b/pypy/module/cpyext/memoryobject.py @@ -1,3 +1,4 @@ +from pypy.interpreter.error import oefmt from pypy.module.cpyext.api import ( cpython_api, CANNOT_FAIL, Py_MAX_FMT, Py_MAX_NDIMS, build_type_checkers, Py_ssize_tP, cts, parse_dir, bootstrap_function, Py_bufferP, slot_function) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92990:92c6fb568fa1 Date: 2017-11-11 15:51 + http://bitbucket.org/pypy/pypy/changeset/92c6fb568fa1/ Log:fix translation diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py --- a/pypy/objspace/std/typeobject.py +++ b/pypy/objspace/std/typeobject.py @@ -977,6 +977,7 @@ w_type.setdictvalue(space, '__doc__', w_value) def type_get_txtsig(space, w_type): +w_type = _check(space, w_type) if w_type.text_signature is None: return space.w_None return space.newtext(w_type.text_signature) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix TARGET_BASENAME for pypy3
Author: Ronan LamyBranch: py3.5 Changeset: r92959:585896fe6599 Date: 2017-11-06 18:22 + http://bitbucket.org/pypy/pypy/changeset/585896fe6599/ Log:Fix TARGET_BASENAME for pypy3 diff --git a/testrunner/get_info.py b/testrunner/get_info.py --- a/testrunner/get_info.py +++ b/testrunner/get_info.py @@ -8,7 +8,7 @@ import json BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -TARGET_BASENAME = 'pypy-c' +TARGET_BASENAME = 'pypy3-c' def make_info_dict(): target = TARGET_BASENAME ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix merge quirks, document merged branch
Author: Matti PicusBranch: py3.5 Changeset: r92886:81a7e5dcbc2d Date: 2017-10-30 19:10 +0200 http://bitbucket.org/pypy/pypy/changeset/81a7e5dcbc2d/ Log:fix merge quirks, document merged branch diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst --- a/pypy/doc/whatsnew-pypy3-head.rst +++ b/pypy/doc/whatsnew-pypy3-head.rst @@ -11,3 +11,6 @@ .. branch: py3.5-appexec Raise if space.is_true(space.appexec()) used in app level tests, fix tests that did this + +.. branch: py3.5-mac-embedding +Download and patch dependencies when building cffi-based stdlib modules diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -1864,7 +1864,7 @@ def sched_yield(): return handle_posix_error('sched_yield', c_sched_yield()) - + #___ c_chroot = external('chroot', [rffi.CCHARP], rffi.INT, diff --git a/rpython/rlib/test/test_rposix.py b/rpython/rlib/test/test_rposix.py --- a/rpython/rlib/test/test_rposix.py +++ b/rpython/rlib/test/test_rposix.py @@ -810,11 +810,6 @@ assert isinstance(low, int) == True assert isinstance(high, int) == True assert high > low - -@rposix_requires('sched_yield') -def test_sched_yield(): -if sys.platform != 'win32': -rposix.sched_yield() @rposix_requires('sched_yield') def test_sched_yield(): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix untranslated test_reimport_builtin(): time.tzname is initialised in a non-standard way that seems to break in untranslated tests
Author: Ronan LamyBranch: py3.5 Changeset: r92813:21d9bc2c1120 Date: 2017-10-21 17:56 +0100 http://bitbucket.org/pypy/pypy/changeset/21d9bc2c1120/ Log:Fix untranslated test_reimport_builtin(): time.tzname is initialised in a non-standard way that seems to break in untranslated tests diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -637,18 +637,18 @@ def test_reimport_builtin(self): import imp, sys, time -oldpath = sys.path -time.tzname = "" +old_sleep = time.sleep +time.sleep = "" del sys.modules['time'] import time as time1 assert sys.modules['time'] is time1 -assert time.tzname == "" +assert time.sleep == "" -imp.reload(time1) # don't leave a broken time.tzname behind +imp.reload(time1) # don't leave a broken time.sleep behind import time -assert time.tzname != "" +assert time.sleep is old_sleep def test_reload_infinite(self): import infinite_reload ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test_abstract in ctypes/test/test_frombuffer.py
Author: Ronan LamyBranch: py3.5 Changeset: r92801:05b154658972 Date: 2017-10-19 18:20 +0100 http://bitbucket.org/pypy/pypy/changeset/05b154658972/ Log:Fix test_abstract in ctypes/test/test_frombuffer.py diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py --- a/lib_pypy/_ctypes/array.py +++ b/lib_pypy/_ctypes/array.py @@ -8,9 +8,14 @@ class ArrayMeta(_CDataMeta): def __new__(self, name, cls, typedict): res = type.__new__(self, name, cls, typedict) + if cls == (_CData,): # this is the Array class defined below +res._ffiarray = None return res - +if not hasattr(res, '_length_') or not isinstance(res._length_, int): +raise AttributeError( +"class must define a '_length_' attribute, " +"which must be a positive integer") ffiarray = res._ffiarray = _rawffi.Array(res._type_._ffishape_) subletter = getattr(res._type_, '_type_', None) if subletter == 'c': @@ -55,7 +60,7 @@ for i in range(len(val)): target[i] = val[i] if len(val) < self._length_: -target[len(val)] = '\x00' +target[len(val)] = u'\x00' res.value = property(getvalue, setvalue) res._ffishape_ = (ffiarray, res._length_) @@ -164,7 +169,7 @@ if letter == 'c': return b"".join(l) if letter == 'u': -return "".join(l) +return u"".join(l) return l class Array(_CData, metaclass=ArrayMeta): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix performance and correctness of PyDict_Next by storing a list of keys instead of a view
Author: Ronan LamyBranch: py3.5 Changeset: r92681:61c11feab4e6 Date: 2017-10-09 16:40 +0200 http://bitbucket.org/pypy/pypy/changeset/61c11feab4e6/ Log:Fix performance and correctness of PyDict_Next by storing a list of keys instead of a view 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 @@ -274,8 +274,9 @@ if pos == 0: # Store the current keys in the PyDictObject. decref(space, py_dict.c__tmpkeys) -w_keys = space.call_method(space.w_dict, "keys", w_dict) +w_keyview = space.call_method(space.w_dict, "keys", w_dict) # w_keys must use the object strategy in order to keep the keys alive +w_keys = space.newlist(space.listview(w_keyview)) w_keys.switch_to_object_strategy() py_dict.c__tmpkeys = create_ref(space, w_keys) Py_IncRef(space, py_dict.c__tmpkeys) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix for issue 2648 and 2649
Author: mihai.do...@gmail.com Branch: py3.5 Changeset: r92644:0a45774261bb Date: 2017-09-26 16:44 +0300 http://bitbucket.org/pypy/pypy/changeset/0a45774261bb/ Log:Fix for issue 2648 and 2649 diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py --- a/pypy/module/_socket/test/test_sock_app.py +++ b/pypy/module/_socket/test/test_sock_app.py @@ -574,6 +574,22 @@ import _socket raises(_socket.error, _socket.dup, 123456) +def test_recvmsg_issue2649(self): +import _socket as socket +listener = socket.socket(family=socket.AF_INET6, type=socket.SOCK_DGRAM) +listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +listener.bind(('::1', 1234)) + +s = socket.socket(family=socket.AF_INET6, type=socket.SOCK_DGRAM) +IPV6_RECVERR = 25 +s.setsockopt(socket.IPPROTO_IPV6, IPV6_RECVERR, 1) + +s.sendto(b'x', ('::1', 1234)) +try: +queue = s.recvmsg(1024, 1024, socket.MSG_ERRQUEUE) +except BlockingIOError as e: +assert True + def test_buffer(self): # Test that send/sendall/sendto accept a buffer as arg import _socket, os diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -162,7 +162,7 @@ IP_RECVRETOPTS IP_RETOPTS IP_TOS IP_TTL MSG_BTAG MSG_ETAG MSG_CTRUNC MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_OOB -MSG_PEEK MSG_TRUNC MSG_WAITALL +MSG_PEEK MSG_TRUNC MSG_WAITALL MSG_ERRQUEUE NI_DGRAM NI_MAXHOST NI_MAXSERV NI_NAMEREQD NI_NOFQDN NI_NUMERICHOST NI_NUMERICSERV ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92636:3f5373832c7a Date: 2017-10-07 17:57 +0200 http://bitbucket.org/pypy/pypy/changeset/3f5373832c7a/ Log:fix translation diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -68,9 +68,10 @@ def unicode_attach(space, py_obj, w_obj, w_userdata=None): "Fills a newly allocated PyUnicodeObject with a unicode string" -set_wsize(py_obj, len(space.unicode_w(w_obj))) +value = space.unicode_w(w_obj) +set_wsize(py_obj, len(value) set_wbuffer(py_obj, lltype.nullptr(rffi.CWCHARP.TO)) -_readify(space, py_obj, w_obj._value) +_readify(space, py_obj, value) def unicode_realize(space, py_obj): """ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit