[Python-checkins] r52059 - in python/branches/release24-maint: Lib/test/test_descr.py Lib/test/test_new.py Misc/NEWS Objects/classobject.c Objects/typeobject.c

georg.brandl python-checkins at python.org
Sat Sep 30 10:43:37 CEST 2006


Author: georg.brandl
Date: Sat Sep 30 10:43:35 2006
New Revision: 52059
Modified:
 python/branches/release24-maint/Lib/test/test_descr.py
 python/branches/release24-maint/Lib/test/test_new.py
 python/branches/release24-maint/Misc/NEWS
 python/branches/release24-maint/Objects/classobject.c
 python/branches/release24-maint/Objects/typeobject.c
Log:
Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
 (backport from rev. 52058)
Modified: python/branches/release24-maint/Lib/test/test_descr.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_descr.py	(original)
+++ python/branches/release24-maint/Lib/test/test_descr.py	Sat Sep 30 10:43:35 2006
@@ -2077,6 +2077,13 @@
 
 veris(Sub.test(), Base.aProp)
 
+ # Verify that super() doesn't allow keyword args
+ try:
+ super(Base, kw=1)
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "super shouldn't accept keyword args"
 
 def inherits():
 if verbose: print "Testing inheritance from basic types..."
Modified: python/branches/release24-maint/Lib/test/test_new.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_new.py	(original)
+++ python/branches/release24-maint/Lib/test/test_new.py	Sat Sep 30 10:43:35 2006
@@ -57,6 +57,14 @@
 else:
 raise TestFailed, "dangerous instance method creation allowed"
 
+# Verify that instancemethod() doesn't allow keyword args
+try:
+ new.instancemethod(break_yolks, c, kw=1)
+except TypeError:
+ pass
+else:
+ raise TestFailed, "instancemethod shouldn't accept keyword args"
+
 # It's unclear what the semantics should be for a code object compiled at
 # module scope, but bound and run in a function. In CPython, `c' is global
 # (by accident?) while in Jython, `c' is local. The intent of the test
Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Sat Sep 30 10:43:35 2006
@@ -12,6 +12,10 @@
 Core and builtins
 -----------------
 
+- Patch #1567691: super() and new.instancemethod() now don't accept
+ keyword arguments any more (previously they accepted them, but didn't
+ use them).
+
 - Bug #1331062: Fix error in UTF-7 codec.
 
 - Bug #1365916: Fix an int/long mismatch in the sorted() built-in.
Modified: python/branches/release24-maint/Objects/classobject.c
==============================================================================
--- python/branches/release24-maint/Objects/classobject.c	(original)
+++ python/branches/release24-maint/Objects/classobject.c	Sat Sep 30 10:43:35 2006
@@ -2211,6 +2211,8 @@
 	PyObject *self;
 	PyObject *classObj = NULL;
 
+	if (!_PyArg_NoKeywords("instancemethod", kw))
+		return NULL;
 	if (!PyArg_UnpackTuple(args, "instancemethod", 2, 3,
 			 &func, &self, &classObj))
 		return NULL;
Modified: python/branches/release24-maint/Objects/typeobject.c
==============================================================================
--- python/branches/release24-maint/Objects/typeobject.c	(original)
+++ python/branches/release24-maint/Objects/typeobject.c	Sat Sep 30 10:43:35 2006
@@ -5706,6 +5706,8 @@
 	PyObject *obj = NULL;
 	PyTypeObject *obj_type = NULL;
 
+	if (!_PyArg_NoKeywords("super", kwds))
+		return -1;
 	if (!PyArg_ParseTuple(args, "O!|O:super", &PyType_Type, &type, &obj))
 		return -1;
 	if (obj == Py_None)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /