Author: Matt Jackson <em...@mwjackson.net> Branch: py3.6 Changeset: r94406:5781b52fc50f Date: 2018-04-21 14:20 +0100 http://bitbucket.org/pypy/pypy/changeset/5781b52fc50f/
Log: (ronan, mwjackson) added kwargs-only for sorted() diff --git a/lib-python/3/test/test_builtin.py b/lib-python/3/test/test_builtin.py --- a/lib-python/3/test/test_builtin.py +++ b/lib-python/3/test/test_builtin.py @@ -1635,8 +1635,12 @@ def test_bad_arguments(self): # Issue #29327: The first argument is positional-only. sorted([]) - with self.assertRaises(TypeError): - sorted(iterable=[]) + + # pypy doesn't support positional only arguments + if check_impl_detail(): + with self.assertRaises(TypeError): + sorted(iterable=[]) + # Other arguments are keyword-only sorted([], key=None) with self.assertRaises(TypeError): diff --git a/pypy/module/__builtin__/app_functional.py b/pypy/module/__builtin__/app_functional.py --- a/pypy/module/__builtin__/app_functional.py +++ b/pypy/module/__builtin__/app_functional.py @@ -4,8 +4,7 @@ """ # ____________________________________________________________ - -def sorted(iterable, key=None, reverse=False): +def sorted(iterable, *, key=None, reverse=False): "sorted(iterable, key=None, reverse=False) --> new sorted list" sorted_lst = list(iterable) sorted_lst.sort(key=key, reverse=reverse) diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py --- a/pypy/module/__builtin__/test/test_builtin.py +++ b/pypy/module/__builtin__/test/test_builtin.py @@ -420,6 +420,7 @@ assert sorted_l is not l assert sorted_l == ['C', 'b', 'a'] raises(TypeError, sorted, [], reverse=None) + raises(TypeError, sorted, [], None) def test_reversed_simple_sequences(self): l = range(5) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit