summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-20 06:33:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-20 06:33:06 (GMT)
commit398ef5c08feabfdbf7d0b1e10817139f0e98eefd (patch)
tree313bc8288fb071b96270f05ce96bf19cc13f1358 /Lib/test/test_builtin.py
parenta57a8a3e2d64dfff1bc843c8b34a6a5e06dbe595 (diff)
downloadcpython-398ef5c08feabfdbf7d0b1e10817139f0e98eefd.zip
cpython-398ef5c08feabfdbf7d0b1e10817139f0e98eefd.tar.gz
cpython-398ef5c08feabfdbf7d0b1e10817139f0e98eefd.tar.bz2
Issue #29327: Fixed a crash when pass the iterable keyword argument to sorted().
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index a792099..416316c 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1627,6 +1627,16 @@ class TestSorted(unittest.TestCase):
self.assertEqual(data, sorted(copy, reverse=1))
self.assertNotEqual(data, copy)
+ def test_bad_arguments(self):
+ # Issue #29327: The first argument is positional-only.
+ sorted([])
+ with self.assertRaises(TypeError):
+ sorted(iterable=[])
+ # Other arguments are keyword-only
+ sorted([], key=None)
+ with self.assertRaises(TypeError):
+ sorted([], None)
+
def test_inputtypes(self):
s = 'abracadabra'
types = [list, tuple, str]