[pypy-commit] pypy py3.5: Avoid importing from the stdlib at translation time.
Author: Ronan Lamy Branch: py3.5 Changeset: r95729:eb0bd5f16264 Date: 2019-01-26 01:50 + http://bitbucket.org/pypy/pypy/changeset/eb0bd5f16264/ Log:Avoid importing from the stdlib at translation time. Makes dict_items, dict_keys, and dict_values instantiable and subclassable. 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 @@ -1,6 +1,5 @@ from __pypy__ import reversed_dict, move_to_end, objects_in_repr from _operator import eq as _eq -import _collections_abc class OrderedDict(dict): @@ -29,7 +28,33 @@ raise TypeError('expected at most 1 arguments, got %d' % len(args)) self.__update(*args, **kwds) -update = __update = _collections_abc.MutableMapping.update +def update(*args, **kwds): +''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. +If E present and has a .keys() method, does: for k in E: D[k] = E[k] +If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v +In either case, this is followed by: for k, v in F.items(): D[k] = v +''' +if not args: +raise TypeError("descriptor 'update' of 'OrderedDict' object " +"needs an argument") +self, *args = args +if len(args) > 1: +raise TypeError('update expected at most 1 arguments, got %d' % +len(args)) +if args: +other = args[0] +if hasattr(other, 'items'): +for key, value in other.items(): +self[key] = value +elif hasattr(other, "keys"): +for key in other.keys(): +self[key] = other[key] +else: +for key, value in other: +self[key] = value +for key, value in kwds.items(): +self[key] = value +__update = update def __reversed__(self): return reversed_dict(self) @@ -106,17 +131,20 @@ "D.values() -> an object providing a view on D's values" return _OrderedDictValuesView(self) +dict_keys = type({}.keys()) +dict_values = type({}.values()) +dict_items = type({}.items()) -class _OrderedDictKeysView(_collections_abc.KeysView): +class _OrderedDictKeysView(dict_keys): def __reversed__(self): yield from reversed_dict(self._mapping) -class _OrderedDictItemsView(_collections_abc.ItemsView): +class _OrderedDictItemsView(dict_items): def __reversed__(self): for key in reversed_dict(self._mapping): yield (key, self._mapping[key]) -class _OrderedDictValuesView(_collections_abc.ValuesView): +class _OrderedDictValuesView(dict_values): def __reversed__(self): for key in reversed_dict(self._mapping): yield self._mapping[key] 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 @@ -1538,6 +1538,12 @@ descr_or, descr_ror = _as_set_op('or', 'update') descr_xor, descr_rxor = _as_set_op('xor', 'symmetric_difference_update') +def new_dict_items(space, w_type, w_dict): +w_dict = space.interp_w(W_DictMultiObject, w_dict) +w_obj = space.allocate_instance(W_DictViewItemsObject, w_type) +W_DictViewObject.__init__(w_obj, space, w_dict) +return w_obj + class W_DictViewItemsObject(W_DictViewObject, SetLikeDictView): def descr_iter(self, space): return W_DictMultiIterItemsObject(space, self.w_dict.iteritems()) @@ -1557,18 +1563,32 @@ return space.w_False return space.newbool(space.eq_w(w_value, w_found)) +def new_dict_keys(space, w_type, w_dict): +w_dict = space.interp_w(W_DictMultiObject, w_dict) +w_obj = space.allocate_instance(W_DictViewKeysObject, w_type) +W_DictViewObject.__init__(w_obj, space, w_dict) +return w_obj + class W_DictViewKeysObject(W_DictViewObject, SetLikeDictView): def descr_iter(self, space): return W_DictMultiIterKeysObject(space, self.w_dict.iterkeys()) + def descr_contains(self, space, w_key): return self.w_dict.descr_contains(space, w_key) +def new_dict_values(space, w_type, w_dict): +w_dict = space.interp_w(W_DictMultiObject, w_dict) +w_obj = space.allocate_instance(W_DictViewValuesObject, w_type) +W_DictViewObject.__init__(w_obj, space, w_dict) +return w_obj + class W_DictViewValuesObject(W_DictViewObject): def descr_iter(self, space): return W_DictMultiIterValuesObject(space, self.w_dict.itervalues()) W_DictViewItemsObject.typedef = TypeDef( "dict_items", +__new__ = interp2app(new_dict_items), __repr__ = interp2app(W_DictViewItemsObject.descr_repr), __len__ = interp2app(W_DictViewItemsObject.descr_len), __iter__ =
[pypy-commit] extradoc extradoc: Fix date.
Author: Manuel Jacob Branch: extradoc Changeset: r5941:be3b514769de Date: 2019-01-25 16:45 +0100 http://bitbucket.org/pypy/extradoc/changeset/be3b514769de/ Log:Fix date. diff --git a/sprintinfo/ddorf2019/people.txt b/sprintinfo/ddorf2019/people.txt --- a/sprintinfo/ddorf2019/people.txt +++ b/sprintinfo/ddorf2019/people.txt @@ -10,7 +10,7 @@ == === Carl Friedrich Bolz-Tereick always there private Matti Picus Feb 4 - 9 airbnb -Manuel Feb 3 - 7? share a room? +Manuel Jacob Feb 3 - 7 share a room? Antonio Cuni Feb 3 - 9 airbnb Andrew Lawrence Feb 3 - 9 backpackers Dsseldorf Alexander Schremmer Feb 4 - 8 Essen, guest room available ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: hg merge default
Author: Antonio Cuni Branch: py3.5 Changeset: r95728:75ae721dc112 Date: 2019-01-25 16:44 +0100 http://bitbucket.org/pypy/pypy/changeset/75ae721dc112/ Log:hg merge default diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst --- a/pypy/doc/how-to-release.rst +++ b/pypy/doc/how-to-release.rst @@ -16,9 +16,6 @@ How to Create a PyPy Release -Overview - - As a meta rule setting up issues in the tracker for items here may help not forgetting things. A set of todo files may also work. @@ -28,17 +25,54 @@ Release Steps -- +++ -* If needed, make a release branch -* Bump the - pypy version number in module/sys/version.py and in - module/cpyext/include/patchlevel.h and in doc/conf.py. The branch - will capture the revision number of this change for the release. +Make the release branch + - Some of the next updates may be done before or after branching; make - sure things are ported back to the trunk and to the branch as - necessary. +This is needed only in case you are doing a new major version; if not, you can +probably reuse the existing release branch. + +We want to be able to freely merge default into the branch and vice-versa; +thus we need to do a complicate dance to avoid to patch the version number +when we do a merge:: + + $ hg up -r default + $ # edit the version to e.g. 7.0.0-final + $ hg ci + $ hg branch release-pypy2.7-7.x && hg ci + $ hg up -r default + $ # edit the version to 7.1.0-alpha0 + $ hg ci + $ hg up -r release-pypy2.7-7.x + $ hg merge default + $ # edit the version to AGAIN 7.0.0-final + $ hg ci + +Then, we need to do the same for the 3.x branch:: + + $ hg up -r py3.5 + $ hg merge default # this brings the version fo 7.1.0-alpha0 + $ hg branch release-pypy3.5-7.x + $ # edit the version to 7.0.0-final + $ hg ci + $ hg up -r py3.5 + $ hg merge release-pypy3.5-7.x + $ # edit the version to 7.1.0-alpha0 + $ hg ci + +To change the version, you need to edit three files: + + - ``module/sys/version.py`` + + - ``module/cpyext/include/patchlevel.h`` + + - ``doc/conf.py`` + + +Other steps +--- + * Make sure the RPython builds on the buildbot pass with no failures diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -32,7 +32,7 @@ * module/sys/version.py * doc/conf.py */ -#define PYPY_VERSION "7.1.0" +#define PYPY_VERSION "7.1.0-alpha0" #define PYPY_VERSION_NUM 0x0701 /* Defined to mean a PyPy where cpyext holds more regular references to PyObjects, e.g. staying alive as long as the internal PyPy object diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -13,7 +13,7 @@ # make sure to keep PYPY_VERSION in sync with: #module/cpyext/include/patchlevel.h #doc/conf.py -PYPY_VERSION = (7, 1, 0, "alpha0", 0) +PYPY_VERSION = (7, 1, 0, "alpha", 0) import pypy ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix the version
Author: Antonio Cuni Branch: Changeset: r95727:a5bef2990aeb Date: 2019-01-25 16:36 +0100 http://bitbucket.org/pypy/pypy/changeset/a5bef2990aeb/ Log:fix the version diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -32,7 +32,7 @@ * module/sys/version.py * doc/conf.py */ -#define PYPY_VERSION "7.1.0" +#define PYPY_VERSION "7.1.0-alpha0" #define PYPY_VERSION_NUM 0x0701 /* Defined to mean a PyPy where cpyext holds more regular references to PyObjects, e.g. staying alive as long as the internal PyPy object diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -13,7 +13,7 @@ # make sure to keep PYPY_VERSION in sync with: #module/cpyext/include/patchlevel.h #doc/conf.py -PYPY_VERSION = (7, 1, 0, "alpha0", 0) +PYPY_VERSION = (7, 1, 0, "alpha", 0) import pypy ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: document the steps I did to create the release branches
Author: Antonio Cuni Branch: Changeset: r95726:c42e8df4ef8c Date: 2019-01-25 16:25 +0100 http://bitbucket.org/pypy/pypy/changeset/c42e8df4ef8c/ Log:document the steps I did to create the release branches diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst --- a/pypy/doc/how-to-release.rst +++ b/pypy/doc/how-to-release.rst @@ -16,9 +16,6 @@ How to Create a PyPy Release -Overview - - As a meta rule setting up issues in the tracker for items here may help not forgetting things. A set of todo files may also work. @@ -28,17 +25,54 @@ Release Steps -- +++ -* If needed, make a release branch -* Bump the - pypy version number in module/sys/version.py and in - module/cpyext/include/patchlevel.h and in doc/conf.py. The branch - will capture the revision number of this change for the release. +Make the release branch + - Some of the next updates may be done before or after branching; make - sure things are ported back to the trunk and to the branch as - necessary. +This is needed only in case you are doing a new major version; if not, you can +probably reuse the existing release branch. + +We want to be able to freely merge default into the branch and vice-versa; +thus we need to do a complicate dance to avoid to patch the version number +when we do a merge:: + + $ hg up -r default + $ # edit the version to e.g. 7.0.0-final + $ hg ci + $ hg branch release-pypy2.7-7.x && hg ci + $ hg up -r default + $ # edit the version to 7.1.0-alpha0 + $ hg ci + $ hg up -r release-pypy2.7-7.x + $ hg merge default + $ # edit the version to AGAIN 7.0.0-final + $ hg ci + +Then, we need to do the same for the 3.x branch:: + + $ hg up -r py3.5 + $ hg merge default # this brings the version fo 7.1.0-alpha0 + $ hg branch release-pypy3.5-7.x + $ # edit the version to 7.0.0-final + $ hg ci + $ hg up -r py3.5 + $ hg merge release-pypy3.5-7.x + $ # edit the version to 7.1.0-alpha0 + $ hg ci + +To change the version, you need to edit three files: + + - ``module/sys/version.py`` + + - ``module/cpyext/include/patchlevel.h`` + + - ``doc/conf.py`` + + +Other steps +--- + * Make sure the RPython builds on the buildbot pass with no failures ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy release-pypy3.5-7.x: create the release branch for py3.5 7.0, and correct the version number
Author: Antonio Cuni Branch: release-pypy3.5-7.x Changeset: r95724:ece1f9ddcb91 Date: 2019-01-25 15:56 +0100 http://bitbucket.org/pypy/pypy/changeset/ece1f9ddcb91/ Log:create the release branch for py3.5 7.0, and correct the version number diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py --- a/pypy/doc/conf.py +++ b/pypy/doc/conf.py @@ -71,9 +71,9 @@ #module/cpyext/include/patchlevel.h # # The short X.Y version. -version = '7.1' +version = '7.0' # The full version, including alpha/beta/rc tags. -release = '7.1.0' +release = '7.0.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -32,8 +32,9 @@ * module/sys/version.py * doc/conf.py */ -#define PYPY_VERSION "7.1.0" -#define PYPY_VERSION_NUM 0x0701 +#define PYPY_VERSION "7.0.0" +#define PYPY_VERSION_NUM 0x0700 + /* Defined to mean a PyPy where cpyext holds more regular references to PyObjects, e.g. staying alive as long as the internal PyPy object stays alive. */ diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -13,7 +13,7 @@ # make sure to keep PYPY_VERSION in sync with: #module/cpyext/include/patchlevel.h #doc/conf.py -PYPY_VERSION = (7, 1, 0, "alpha0", 0) +PYPY_VERSION = (7, 0, 0, "final", 0) import pypy ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: merge release-pypy3.5-7.x into the development branch, and make sure to keep the correct development version
Author: Antonio Cuni Branch: py3.5 Changeset: r95725:b8fff341cb4d Date: 2019-01-25 15:57 +0100 http://bitbucket.org/pypy/pypy/changeset/b8fff341cb4d/ Log:merge release-pypy3.5-7.x into the development branch, and make sure to keep the correct development version ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: hg merge default; this bump the version to 7.1-alpha0
Author: Antonio Cuni Branch: py3.5 Changeset: r95723:4b2995821717 Date: 2019-01-25 15:52 +0100 http://bitbucket.org/pypy/pypy/changeset/4b2995821717/ Log:hg merge default; this bump the version to 7.1-alpha0 diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py --- a/pypy/doc/conf.py +++ b/pypy/doc/conf.py @@ -65,10 +65,15 @@ # |version| and |release|, also used in various other places throughout the # built documents. # + +# Make sure to keep this in sync with: +#module/sys/version.py +#module/cpyext/include/patchlevel.h +# # The short X.Y version. -version = '6.0' +version = '7.1' # The full version, including alpha/beta/rc tags. -release = '6.0.0' +release = '7.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -28,10 +28,12 @@ /* Version as a string */ #define PY_VERSION "3.5.3" -/* PyPy version as a string */ -#define PYPY_VERSION "6.1.0-alpha0" -#define PYPY_VERSION_NUM 0x0601 - +/* PyPy version as a string: make sure to keep this in sync with: + * module/sys/version.py + * doc/conf.py + */ +#define PYPY_VERSION "7.1.0" +#define PYPY_VERSION_NUM 0x0701 /* Defined to mean a PyPy where cpyext holds more regular references to PyObjects, e.g. staying alive as long as the internal PyPy object stays alive. */ diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -10,7 +10,10 @@ #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py CPYTHON_API_VERSION= 1013 #XXX # sync with include/modsupport.h -PYPY_VERSION = (6, 1, 0, "alpha", 0)#XXX # sync patchlevel.h +# make sure to keep PYPY_VERSION in sync with: +#module/cpyext/include/patchlevel.h +#doc/conf.py +PYPY_VERSION = (7, 1, 0, "alpha0", 0) import pypy diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py --- a/rpython/rlib/objectmodel.py +++ b/rpython/rlib/objectmodel.py @@ -991,7 +991,9 @@ items = d.items() d.clear() d[key] = value -d.update(items) +# r_dict.update does not support list of tuples, do it manually +for key, value in items: +d[key] = value @specialize.call_location() def move_to_end(d, key, last=True): diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -708,6 +708,15 @@ move_to_end(d, 'key1', last=False) assert d.items() == [('key1', 'val1'), ('key2', 'val2'), ('key3', 'val3')] +def test_r_dict_move_to_end(): +d = r_dict(strange_key_eq, strange_key_hash) +d['1key'] = 'val1' +d['2key'] = 'val2' +d['3key'] = 'val3' +# does not crash, we can't check that it actually moves to end on CPython +move_to_end(d, '1key') +move_to_end(d, '1key', last=False) + def test_import_from_mixin(): class M:# old-style def f(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy unicode-utf8-py3: fix remaining failing tests
Author: Carl Friedrich Bolz-Tereick Branch: unicode-utf8-py3 Changeset: r95722:b37c4fff34a0 Date: 2019-01-25 14:55 +0100 http://bitbucket.org/pypy/pypy/changeset/b37c4fff34a0/ Log:fix remaining failing tests 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 @@ -433,8 +433,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: -uni_name = str_decode_utf8(self.name, "string", True, None)[0] -str_dict[uni_name] = obj._mapdict_read_storage(self.storageindex) +w_key = space.newtext(self.name) +str_dict[w_key] = obj._mapdict_read_storage(self.storageindex) else: self._copy_attr(obj, new_obj) return new_obj diff --git a/pypy/objspace/std/test/test_kwargsdict.py b/pypy/objspace/std/test/test_kwargsdict.py --- a/pypy/objspace/std/test/test_kwargsdict.py +++ b/pypy/objspace/std/test/test_kwargsdict.py @@ -82,7 +82,7 @@ for i in range(100): assert d.setitem_str("%s" % i, 4) is None assert d.get_strategy() is not strategy -assert "ObjectDictStrategy" == d.get_strategy().__class__.__name__ +assert "UnicodeDictStrategy" == d.get_strategy().__class__.__name__ def test_keys_doesnt_wrap(): space = FakeSpace() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit