[Python-checkins] r80205 - in python/branches/py3k: Lib/test/test_set.py Objects/setobject.c

raymond.hettinger python-checkins at python.org
Mon Apr 19 01:05:22 CEST 2010


Author: raymond.hettinger
Date: Mon Apr 19 01:05:22 2010
New Revision: 80205

Log:
Issue 8436: set.__init__ accepts keyword args

Modified:
   python/branches/py3k/Lib/test/test_set.py
   python/branches/py3k/Objects/setobject.c

Modified: python/branches/py3k/Lib/test/test_set.py
==============================================================================
--- python/branches/py3k/Lib/test/test_set.py	(original)
+++ python/branches/py3k/Lib/test/test_set.py	Mon Apr 19 01:05:22 2010
@@ -48,6 +48,7 @@
 
     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)

Modified: python/branches/py3k/Objects/setobject.c
==============================================================================
--- python/branches/py3k/Objects/setobject.c	(original)
+++ python/branches/py3k/Objects/setobject.c	Mon Apr 19 01:05:22 2010
@@ -1978,6 +1978,8 @@
 
 	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);


More information about the Python-checkins mailing list