mirror of https://github.com/python/cpython
Issue 8436: set.__init__ accepts keyword args
This commit is contained in:
parent
9958c56eb0
commit
35b76027f9
|
@ -1,3 +1,4 @@
|
|||
|
||||
import unittest
|
||||
from test import test_support
|
||||
import gc
|
||||
|
@ -47,6 +48,7 @@ class TestJointOps(unittest.TestCase):
|
|||
|
||||
def test_new_or_init(self):
|
||||
self.assertRaises(TypeError, self.thetype, [], 2)
|
||||
self.assertRaises(TypeError, set().__init__, a=1)
|
||||
|
||||
def test_uniquification(self):
|
||||
actual = sorted(self.s)
|
||||
|
|
|
@ -1987,6 +1987,8 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds)
|
|||
|
||||
if (!PyAnySet_Check(self))
|
||||
return -1;
|
||||
if (PySet_Check(self) && !_PyArg_NoKeywords("set()", kwds))
|
||||
return -1;
|
||||
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
|
||||
return -1;
|
||||
set_clear_internal(self);
|
||||
|
|
Loading…
Reference in New Issue