Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.6 Changeset: r95743:c5adb85f6de1 Date: 2019-01-28 19:02 +0000 http://bitbucket.org/pypy/pypy/changeset/c5adb85f6de1/
Log: hg merge py3.5 diff --git a/lib_pypy/_collections.py b/lib_pypy/_collections.py --- a/lib_pypy/_collections.py +++ b/lib_pypy/_collections.py @@ -390,7 +390,7 @@ class defaultdict(dict): __slots__ = ["default_factory"] - + def __init__(self, *args, **kwds): if len(args) > 0: default_factory = args[0] @@ -401,10 +401,10 @@ default_factory = None self.default_factory = default_factory super(defaultdict, self).__init__(*args, **kwds) - + def __missing__(self, key): # from defaultdict docs - if self.default_factory is None: + if self.default_factory is None: raise KeyError(key) self[key] = value = self.default_factory() return value @@ -420,7 +420,7 @@ def copy(self): return type(self)(self.default_factory, self) - + def __copy__(self): return self.copy() @@ -438,9 +438,3 @@ """ return (type(self), (self.default_factory,), None, None, iter(self.items())) - - -try: - from _pypy_collections import OrderedDict -except ImportError: - pass diff --git a/pypy/module/_collections/__init__.py b/pypy/module/_collections/__init__.py --- a/pypy/module/_collections/__init__.py +++ b/pypy/module/_collections/__init__.py @@ -8,6 +8,7 @@ appleveldefs = { 'defaultdict': 'app_defaultdict.defaultdict', + 'OrderedDict': 'app_odict.OrderedDict', } interpleveldefs = { @@ -25,15 +26,3 @@ space = self.space space.getattr(self, space.newtext('defaultdict')) # force importing space.delattr(self, space.newtext('__missing__')) - - def startup(self, space): - # OrderedDict is normally present, but in some cases the line - # "from __pypy__ import reversed_dict, move_to_end" from - # _pypy_collections.py raises - space.appexec([self], """(mod): - try: - from _pypy_collections import OrderedDict - mod.OrderedDict = OrderedDict - except ImportError: - pass - """) diff --git a/lib_pypy/_pypy_collections.py b/pypy/module/_collections/app_odict.py rename from lib_pypy/_pypy_collections.py rename to pypy/module/_collections/app_odict.py _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit