[Python-3000-checkins] r57871 - in python/branches/py3k: Doc/c-api/newtypes.rst Include/methodobject.h Objects/methodobject.c

georg.brandl python-3000-checkins at python.org
Sat Sep 1 16:00:02 CEST 2007


Author: georg.brandl
Date: Sat Sep  1 15:59:50 2007
New Revision: 57871

Modified:
   python/branches/py3k/Doc/c-api/newtypes.rst
   python/branches/py3k/Include/methodobject.h
   python/branches/py3k/Objects/methodobject.c
Log:
Get rid of METH_OLDARGS.


Modified: python/branches/py3k/Doc/c-api/newtypes.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/newtypes.rst	(original)
+++ python/branches/py3k/Doc/c-api/newtypes.rst	Sat Sep  1 15:59:50 2007
@@ -255,16 +255,6 @@
    :ctype:`PyObject\*` parameter representing the single argument.
 
 
-.. XXX deprecated, should be removed
-.. data:: METH_OLDARGS
-
-   This calling convention is deprecated.  The method must be of type
-   :ctype:`PyCFunction`.  The second argument is *NULL* if no arguments are given,
-   a single object if exactly one argument is given, and a tuple of objects if more
-   than one argument is given.  There is no way for a function using this
-   convention to distinguish between a call with multiple arguments and a call with
-   a tuple as the only argument.
-
 These two constants are not used to indicate the calling convention but the
 binding when use with methods of classes.  These may not be used for functions
 defined for modules.  At most one of these flags may be set for any given

Modified: python/branches/py3k/Include/methodobject.h
==============================================================================
--- python/branches/py3k/Include/methodobject.h	(original)
+++ python/branches/py3k/Include/methodobject.h	Sat Sep  1 15:59:50 2007
@@ -50,7 +50,7 @@
 					 PyObject *);
 
 /* Flag passed to newmethodobject */
-#define METH_OLDARGS  0x0000
+/* #define METH_OLDARGS  0x0000   -- unsupported now */
 #define METH_VARARGS  0x0001
 #define METH_KEYWORDS 0x0002
 /* METH_NOARGS and METH_O must not be combined with the flags above. */

Modified: python/branches/py3k/Objects/methodobject.c
==============================================================================
--- python/branches/py3k/Objects/methodobject.c	(original)
+++ python/branches/py3k/Objects/methodobject.c	Sat Sep  1 15:59:50 2007
@@ -73,7 +73,6 @@
 			return (*meth)(self, arg);
 		break;
 	case METH_VARARGS | METH_KEYWORDS:
-	case METH_OLDARGS | METH_KEYWORDS:
 		return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
 	case METH_NOARGS:
 		if (kw == NULL || PyDict_Size(kw) == 0) {
@@ -97,19 +96,11 @@
 			return NULL;
 		}
 		break;
-	case METH_OLDARGS:
-		/* the really old style */
-		if (kw == NULL || PyDict_Size(kw) == 0) {
-			size = PyTuple_GET_SIZE(arg);
-			if (size == 1)
-				arg = PyTuple_GET_ITEM(arg, 0);
-			else if (size == 0)
-				arg = NULL;
-			return (*meth)(self, arg);
-		}
-		break;
 	default:
-		PyErr_BadInternalCall();
+		PyErr_SetString(PyExc_SystemError, "Bad call flags in "
+				"PyCFunction_Call. METH_OLDARGS is no "
+				"longer supported!");
+			
 		return NULL;
 	}
 	PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",


More information about the Python-3000-checkins mailing list