[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.225,2.226 ceval.c,2.266,2.267 sysmodule.c,2.90,2.91

Martin v. L?wis loewis@users.sourceforge.net
Thu, 16 Aug 2001 06:15:02 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv23257/Python

Modified Files:
	bltinmodule.c ceval.c sysmodule.c 
Log Message:
Patch #427190: Implement and use METH_NOARGS and METH_O.


Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.225
retrieving revision 2.226
diff -C2 -d -r2.225 -r2.226
*** bltinmodule.c	2001/08/08 10:28:06	2.225
--- bltinmodule.c	2001/08/16 13:15:00	2.226
***************
*** 54,63 ****
  
  static PyObject *
! builtin_abs(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
- 
- 	if (!PyArg_ParseTuple(args, "O:abs", &v))
- 		return NULL;
  	return PyNumber_Absolute(v);
  }
--- 54,59 ----
  
  static PyObject *
! builtin_abs(PyObject *self, PyObject *v)
  {
  	return PyNumber_Absolute(v);
  }
***************
*** 133,142 ****
  
  static PyObject *
! builtin_callable(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
- 
- 	if (!PyArg_ParseTuple(args, "O:callable", &v))
- 		return NULL;
  	return PyInt_FromLong((long)PyCallable_Check(v));
  }
--- 129,134 ----
  
  static PyObject *
! builtin_callable(PyObject *self, PyObject *v)
  {
  	return PyInt_FromLong((long)PyCallable_Check(v));
  }
***************
*** 668,677 ****
  
  static PyObject *
! builtin_globals(PyObject *self, PyObject *args)
  {
  	PyObject *d;
  
- 	if (!PyArg_ParseTuple(args, ":globals"))
- 		return NULL;
  	d = PyEval_GetGlobals();
  	Py_INCREF(d);
--- 660,667 ----
  
  static PyObject *
! builtin_globals(PyObject *self)
  {
  	PyObject *d;
  
  	d = PyEval_GetGlobals();
  	Py_INCREF(d);
***************
*** 723,732 ****
  
  static PyObject *
! builtin_id(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
- 
- 	if (!PyArg_ParseTuple(args, "O:id", &v))
- 		return NULL;
  	return PyLong_FromVoidPtr(v);
  }
--- 713,718 ----
  
  static PyObject *
! builtin_id(PyObject *self, PyObject *v)
  {
  	return PyLong_FromVoidPtr(v);
  }
***************
*** 950,960 ****
  
  static PyObject *
! builtin_hash(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
  	long x;
  
- 	if (!PyArg_ParseTuple(args, "O:hash", &v))
- 		return NULL;
  	x = PyObject_Hash(v);
  	if (x == -1)
--- 936,943 ----
  
  static PyObject *
! builtin_hash(PyObject *self, PyObject *v)
  {
  	long x;
  
  	x = PyObject_Hash(v);
  	if (x == -1)
***************
*** 971,982 ****
  
  static PyObject *
! builtin_hex(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
  	PyNumberMethods *nb;
  
- 	if (!PyArg_ParseTuple(args, "O:hex", &v))
- 		return NULL;
- 
  	if ((nb = v->ob_type->tp_as_number) == NULL ||
  	    nb->nb_hex == NULL) {
--- 954,961 ----
  
  static PyObject *
! builtin_hex(PyObject *self, PyObject *v)
  {
  	PyNumberMethods *nb;
  
  	if ((nb = v->ob_type->tp_as_number) == NULL ||
  	    nb->nb_hex == NULL) {
***************
*** 1076,1086 ****
  
  static PyObject *
! builtin_len(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
  	long res;
  
- 	if (!PyArg_ParseTuple(args, "O:len", &v))
- 		return NULL;
  	res = PyObject_Size(v);
  	if (res < 0 && PyErr_Occurred())
--- 1055,1062 ----
  
  static PyObject *
! builtin_len(PyObject *self, PyObject *v)
  {
  	long res;
  
  	res = PyObject_Size(v);
  	if (res < 0 && PyErr_Occurred())
***************
*** 1121,1130 ****
  
  static PyObject *
! builtin_locals(PyObject *self, PyObject *args)
  {
  	PyObject *d;
  
- 	if (!PyArg_ParseTuple(args, ":locals"))
- 		return NULL;
  	d = PyEval_GetLocals();
  	Py_INCREF(d);
--- 1097,1104 ----
  
  static PyObject *
! builtin_locals(PyObject *self)
  {
  	PyObject *d;
  
  	d = PyEval_GetLocals();
  	Py_INCREF(d);
***************
*** 1218,1228 ****
  
  static PyObject *
! builtin_oct(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
  	PyNumberMethods *nb;
  
- 	if (!PyArg_ParseTuple(args, "O:oct", &v))
- 		return NULL;
  	if (v == NULL || (nb = v->ob_type->tp_as_number) == NULL ||
  	    nb->nb_oct == NULL) {
--- 1192,1199 ----
  
  static PyObject *
! builtin_oct(PyObject *self, PyObject *v)
  {
  	PyNumberMethods *nb;
  
  	if (v == NULL || (nb = v->ob_type->tp_as_number) == NULL ||
  	    nb->nb_oct == NULL) {
***************
*** 1271,1283 ****
  
  static PyObject *
! builtin_ord(PyObject *self, PyObject *args)
  {
- 	PyObject *obj;
  	long ord;
  	int size;
  
- 	if (!PyArg_ParseTuple(args, "O:ord", &obj))
- 		return NULL;
- 
  	if (PyString_Check(obj)) {
  		size = PyString_GET_SIZE(obj);
--- 1242,1250 ----
  
  static PyObject *
! builtin_ord(PyObject *self, PyObject* obj)
  {
  	long ord;
  	int size;
  
  	if (PyString_Check(obj)) {
  		size = PyString_GET_SIZE(obj);
***************
*** 1612,1621 ****
  
  static PyObject *
! builtin_reload(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
- 
- 	if (!PyArg_ParseTuple(args, "O:reload", &v))
- 		return NULL;
  	return PyImport_ReloadModule(v);
  }
--- 1579,1584 ----
  
  static PyObject *
! builtin_reload(PyObject *self, PyObject *v)
  {
  	return PyImport_ReloadModule(v);
  }
***************
*** 1628,1637 ****
  
  static PyObject *
! builtin_repr(PyObject *self, PyObject *args)
  {
- 	PyObject *v;
- 
- 	if (!PyArg_ParseTuple(args, "O:repr", &v))
- 		return NULL;
  	return PyObject_Repr(v);
  }
--- 1591,1596 ----
  
  static PyObject *
! builtin_repr(PyObject *self, PyObject *v)
  {
  	return PyObject_Repr(v);
  }
***************
*** 1842,1892 ****
  
  static PyMethodDef builtin_methods[] = {
! 	{"__import__",	builtin___import__, 1, import_doc},
! 	{"abs",		builtin_abs, 1, abs_doc},
! 	{"apply",	builtin_apply, 1, apply_doc},
! 	{"buffer",	builtin_buffer, 1, buffer_doc},
! 	{"callable",	builtin_callable, 1, callable_doc},
! 	{"chr",		builtin_chr, 1, chr_doc},
! 	{"cmp",		builtin_cmp, 1, cmp_doc},
! 	{"coerce",	builtin_coerce, 1, coerce_doc},
! 	{"compile",	builtin_compile, 1, compile_doc},
! 	{"delattr",	builtin_delattr, 1, delattr_doc},
! 	{"dir",		builtin_dir, 1, dir_doc},
! 	{"divmod",	builtin_divmod, 1, divmod_doc},
! 	{"eval",	builtin_eval, 1, eval_doc},
! 	{"execfile",	builtin_execfile, 1, execfile_doc},
! 	{"filter",	builtin_filter, 1, filter_doc},
! 	{"getattr",	builtin_getattr, 1, getattr_doc},
! 	{"globals",	builtin_globals, 1, globals_doc},
! 	{"hasattr",	builtin_hasattr, 1, hasattr_doc},
! 	{"hash",	builtin_hash, 1, hash_doc},
! 	{"hex",		builtin_hex, 1, hex_doc},
! 	{"id",		builtin_id, 1, id_doc},
! 	{"input",	builtin_input, 1, input_doc},
! 	{"intern",	builtin_intern, 1, intern_doc},
! 	{"isinstance",  builtin_isinstance, 1, isinstance_doc},
! 	{"issubclass",  builtin_issubclass, 1, issubclass_doc},
! 	{"iter",	builtin_iter, 1, iter_doc},
! 	{"len",		builtin_len, 1, len_doc},
! 	{"locals",	builtin_locals, 1, locals_doc},
! 	{"map",		builtin_map, 1, map_doc},
! 	{"max",		builtin_max, 1, max_doc},
! 	{"min",		builtin_min, 1, min_doc},
! 	{"oct",		builtin_oct, 1, oct_doc},
! 	{"open",	builtin_open, 1, open_doc},
! 	{"ord",		builtin_ord, 1, ord_doc},
! 	{"pow",		builtin_pow, 1, pow_doc},
! 	{"range",	builtin_range, 1, range_doc},
! 	{"raw_input",	builtin_raw_input, 1, raw_input_doc},
! 	{"reduce",	builtin_reduce, 1, reduce_doc},
! 	{"reload",	builtin_reload, 1, reload_doc},
! 	{"repr",	builtin_repr, 1, repr_doc},
! 	{"round",	builtin_round, 1, round_doc},
! 	{"setattr",	builtin_setattr, 1, setattr_doc},
! 	{"slice",       builtin_slice, 1, slice_doc},
! 	{"unichr",	builtin_unichr, 1, unichr_doc},
! 	{"vars",	builtin_vars, 1, vars_doc},
! 	{"xrange",	builtin_xrange, 1, xrange_doc},
!  	{"zip",         builtin_zip, 1, zip_doc},
  	{NULL,		NULL},
  };
--- 1801,1851 ----
  
  static PyMethodDef builtin_methods[] = {
!  	{"__import__",	builtin___import__, METH_VARARGS, import_doc},
!  	{"abs",		builtin_abs,        METH_O, abs_doc},
!  	{"apply",	builtin_apply,      METH_VARARGS, apply_doc},
!  	{"buffer",	builtin_buffer,     METH_VARARGS, buffer_doc},
!  	{"callable",	builtin_callable,   METH_O, callable_doc},
!  	{"chr",		builtin_chr,        METH_VARARGS, chr_doc},
!  	{"cmp",		builtin_cmp,        METH_VARARGS, cmp_doc},
!  	{"coerce",	builtin_coerce,     METH_VARARGS, coerce_doc},
!  	{"compile",	builtin_compile,    METH_VARARGS, compile_doc},
!  	{"delattr",	builtin_delattr,    METH_VARARGS, delattr_doc},
!  	{"dir",		builtin_dir,        METH_VARARGS, dir_doc},
!  	{"divmod",	builtin_divmod,     METH_VARARGS, divmod_doc},
!  	{"eval",	builtin_eval,       METH_VARARGS, eval_doc},
!  	{"execfile",	builtin_execfile,   METH_VARARGS, execfile_doc},
!  	{"filter",	builtin_filter,     METH_VARARGS, filter_doc},
!  	{"getattr",	builtin_getattr,    METH_VARARGS, getattr_doc},
!  	{"globals",	(PyCFunction)builtin_globals,    METH_NOARGS, globals_doc},
!  	{"hasattr",	builtin_hasattr,    METH_VARARGS, hasattr_doc},
!  	{"hash",	builtin_hash,       METH_O, hash_doc},
!  	{"hex",		builtin_hex,        METH_O, hex_doc},
!  	{"id",		builtin_id,         METH_O, id_doc},
!  	{"input",	builtin_input,      METH_VARARGS, input_doc},
!  	{"intern",	builtin_intern,     METH_VARARGS, intern_doc},
!  	{"isinstance",  builtin_isinstance, METH_VARARGS, isinstance_doc},
!  	{"issubclass",  builtin_issubclass, METH_VARARGS, issubclass_doc},
!  	{"iter",	builtin_iter,       METH_VARARGS, iter_doc},
!  	{"len",		builtin_len,        METH_O, len_doc},
!  	{"locals",	(PyCFunction)builtin_locals,     METH_NOARGS, locals_doc},
!  	{"map",		builtin_map,        METH_VARARGS, map_doc},
!  	{"max",		builtin_max,        METH_VARARGS, max_doc},
!  	{"min",		builtin_min,        METH_VARARGS, min_doc},
!  	{"oct",		builtin_oct,        METH_O, oct_doc},
!  	{"open",	builtin_open,       METH_VARARGS, open_doc},
!  	{"ord",		builtin_ord,        METH_O, ord_doc},
!  	{"pow",		builtin_pow,        METH_VARARGS, pow_doc},
!  	{"range",	builtin_range,      METH_VARARGS, range_doc},
!  	{"raw_input",	builtin_raw_input,  METH_VARARGS, raw_input_doc},
!  	{"reduce",	builtin_reduce,     METH_VARARGS, reduce_doc},
!  	{"reload",	builtin_reload,     METH_O, reload_doc},
!  	{"repr",	builtin_repr,       METH_O, repr_doc},
!  	{"round",	builtin_round,      METH_VARARGS, round_doc},
!  	{"setattr",	builtin_setattr,    METH_VARARGS, setattr_doc},
!  	{"slice",       builtin_slice,      METH_VARARGS, slice_doc},
!  	{"unichr",	builtin_unichr,     METH_VARARGS, unichr_doc},
!  	{"vars",	builtin_vars,       METH_VARARGS, vars_doc},
!  	{"xrange",	builtin_xrange,     METH_VARARGS, xrange_doc},
!   	{"zip",         builtin_zip,        METH_VARARGS, zip_doc},
  	{NULL,		NULL},
  };

Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.266
retrieving revision 2.267
diff -C2 -d -r2.266 -r2.267
*** ceval.c	2001/08/12 21:52:24	2.266
--- ceval.c	2001/08/16 13:15:00	2.267
***************
*** 167,177 ****
  
  static PyObject *
! gen_next(genobject *gen, PyObject *args)
  {
  	PyObject *result;
  
- 	if (!PyArg_ParseTuple(args, ":next"))
- 		return NULL;
- 
  	result = gen_iternext(gen);
  
--- 167,174 ----
  
  static PyObject *
! gen_next(genobject *gen)
  {
  	PyObject *result;
  
  	result = gen_iternext(gen);
  
***************
*** 192,196 ****
  
  static struct PyMethodDef gen_methods[] = {
! 	{"next",     (PyCFunction)gen_next, METH_VARARGS,
  	 	"next() -- get the next value, or raise StopIteration"},
  	{NULL,          NULL}   /* Sentinel */
--- 189,193 ----
  
  static struct PyMethodDef gen_methods[] = {
! 	{"next",     (PyCFunction)gen_next, METH_NOARGS,
  	 	"next() -- get the next value, or raise StopIteration"},
  	{NULL,          NULL}   /* Sentinel */
***************
*** 1939,1943 ****
  		    if (PyCFunction_Check(func)) {
  			    int flags = PyCFunction_GET_FLAGS(func);
! 			    if (flags > 1 || nk != 0) 
  				    x = do_call(func, &stack_pointer,
  						na, nk);
--- 1936,1940 ----
  		    if (PyCFunction_Check(func)) {
  			    int flags = PyCFunction_GET_FLAGS(func);
! 			    if (nk != 0 || (flags & METH_KEYWORDS))
  				    x = do_call(func, &stack_pointer,
  						na, nk);
***************
*** 1947,1953 ****
  				    x = PyCFunction_Call(func, callargs, NULL);
  				    Py_XDECREF(callargs); 
! 			    } else if (!(flags & METH_KEYWORDS))
! 				       x = fast_cfunction(func,
! 							  &stack_pointer, na);
  		    } else {
  			    if (PyMethod_Check(func)
--- 1944,1950 ----
  				    x = PyCFunction_Call(func, callargs, NULL);
  				    Py_XDECREF(callargs); 
! 			    } else
! 				    x = fast_cfunction(func,
! 						       &stack_pointer, na);
  		    } else {
  			    if (PyMethod_Check(func)
***************
*** 3047,3064 ****
  	PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  	PyObject *self = PyCFunction_GET_SELF(func);
  
!  	if (na == 0)
!  		return (*meth)(self, NULL);
!  	else if (na == 1) {
!  		PyObject *arg = EXT_POP(*pp_stack);
!  		PyObject *result =  (*meth)(self, arg);
!  		Py_DECREF(arg);
!  		return result;
!  	} else {
!  		PyObject *args = load_args(pp_stack, na);
!  		PyObject *result = (*meth)(self, args);
!  		Py_DECREF(args);
!  		return result;
! 	}
  }
  
--- 3044,3091 ----
  	PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  	PyObject *self = PyCFunction_GET_SELF(func);
+ 	int flags = PyCFunction_GET_FLAGS(func);
  
! 	switch (flags) {
! 	case METH_OLDARGS:
! 		if (na == 0)
! 			return (*meth)(self, NULL);
! 		else if (na == 1) {
! 			PyObject *arg = EXT_POP(*pp_stack);
! 			PyObject *result =  (*meth)(self, arg);
! 			Py_DECREF(arg);
! 			return result;
! 		} else {
! 			PyObject *args = load_args(pp_stack, na);
! 			PyObject *result = (*meth)(self, args);
! 			Py_DECREF(args);
! 			return result;
! 		}
! 		break;
! 	case METH_NOARGS:
! 		if (na == 0)
! 			return (*meth)(self, NULL);
! 		PyErr_Format(PyExc_TypeError,
! 			     "%.200s() takes no arguments (%d given)",
! 			     ((PyCFunctionObject*)func)->m_ml->ml_name, na);
! 		return NULL;
! 		break;
! 	case METH_O:
! 		if (na == 1) {
! 			PyObject *arg = EXT_POP(*pp_stack);
! 			PyObject *result = (*meth)(self, arg);
! 			Py_DECREF(arg);
! 			return result;
! 		}
! 		PyErr_Format(PyExc_TypeError,
! 			     "%.200s() takes exactly one argument (%d given)",
! 			     ((PyCFunctionObject*)func)->m_ml->ml_name, na);
! 		return NULL;
! 		break;
! 	default:
! 		fprintf(stderr, "%.200s() flags = %d\n", 
! 			((PyCFunctionObject*)func)->m_ml->ml_name, flags);
! 		PyErr_BadInternalCall();
! 		return NULL;
! 	}		
  }
  

Index: sysmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v
retrieving revision 2.90
retrieving revision 2.91
diff -C2 -d -r2.90 -r2.91
*** sysmodule.c	2001/07/23 13:32:43	2.90
--- sysmodule.c	2001/08/16 13:15:00	2.91
***************
*** 69,75 ****
  
  static PyObject *
! sys_displayhook(PyObject *self, PyObject *args)
  {
! 	PyObject *o, *outf;
  	PyInterpreterState *interp = PyThreadState_Get()->interp;
  	PyObject *modules = interp->modules;
--- 69,75 ----
  
  static PyObject *
! sys_displayhook(PyObject *self, PyObject *o)
  {
! 	PyObject *outf;
  	PyInterpreterState *interp = PyThreadState_Get()->interp;
  	PyObject *modules = interp->modules;
***************
*** 81,88 ****
  	}
  
- 	/* parse arguments */
- 	if (!PyArg_ParseTuple(args, "O:displayhook", &o))
- 		return NULL;
- 
  	/* Print value except if None */
  	/* After printing, also assign to '_' */
--- 81,84 ----
***************
*** 134,142 ****
  
  static PyObject *
! sys_exc_info(PyObject *self, PyObject *args)
  {
  	PyThreadState *tstate;
- 	if (!PyArg_ParseTuple(args, ":exc_info"))
- 		return NULL;
  	tstate = PyThreadState_Get();
  	return Py_BuildValue(
--- 130,136 ----
  
  static PyObject *
! sys_exc_info(PyObject *self)
  {
  	PyThreadState *tstate;
  	tstate = PyThreadState_Get();
  	return Py_BuildValue(
***************
*** 172,179 ****
  
  static PyObject *
! sys_getdefaultencoding(PyObject *self, PyObject *args)
  {
- 	if (!PyArg_ParseTuple(args, ":getdefaultencoding"))
- 		return NULL;
  	return PyString_FromString(PyUnicode_GetDefaultEncoding());
  }
--- 166,171 ----
  
  static PyObject *
! sys_getdefaultencoding(PyObject *self)
  {
  	return PyString_FromString(PyUnicode_GetDefaultEncoding());
  }
***************
*** 386,393 ****
  
  static PyObject *
! sys_getrecursionlimit(PyObject *self, PyObject *args)
  {
- 	if (!PyArg_ParseTuple(args, ":getrecursionlimit"))
- 		return NULL;
  	return PyInt_FromLong(Py_GetRecursionLimit());
  }
--- 378,383 ----
  
  static PyObject *
! sys_getrecursionlimit(PyObject *self)
  {
  	return PyInt_FromLong(Py_GetRecursionLimit());
  }
***************
*** 428,433 ****
  {
          PyThreadState *tstate = PyThreadState_Get();
- 	if (!PyArg_ParseTuple(args, ":getdlopenflags"))
- 		return NULL;
          if (!tstate)
  		return NULL;
--- 418,421 ----
***************
*** 469,477 ****
  #ifdef Py_TRACE_REFS
  static PyObject *
! sys_gettotalrefcount(PyObject *self, PyObject *args)
  {
  	extern long _Py_RefTotal;
- 	if (!PyArg_ParseTuple(args, ":gettotalrefcount"))
- 		return NULL;
  	return PyInt_FromLong(_Py_RefTotal);
  }
--- 457,463 ----
  #ifdef Py_TRACE_REFS
  static PyObject *
! sys_gettotalrefcount(PyObject *self)
  {
  	extern long _Py_RefTotal;
  	return PyInt_FromLong(_Py_RefTotal);
  }
***************
*** 487,496 ****
  #ifdef COUNT_ALLOCS
  static PyObject *
! sys_getcounts(PyObject *self, PyObject *args)
  {
  	extern PyObject *get_counts(void);
  
- 	if (!PyArg_ParseTuple(args, ":getcounts"))
- 		return NULL;
  	return get_counts();
  }
--- 473,480 ----
  #ifdef COUNT_ALLOCS
  static PyObject *
! sys_getcounts(PyObject *self)
  {
  	extern PyObject *get_counts(void);
  
  	return get_counts();
  }
***************
*** 543,585 ****
  static PyMethodDef sys_methods[] = {
  	/* Might as well keep this in alphabetic order */
! 	{"displayhook",	sys_displayhook, 1, displayhook_doc},
! 	{"exc_info",	sys_exc_info, 1, exc_info_doc},
! 	{"excepthook",	sys_excepthook, 1, excepthook_doc},
! 	{"exit",	sys_exit, 0, exit_doc},
! 	{"getdefaultencoding", sys_getdefaultencoding, 1,
  	 getdefaultencoding_doc}, 
  #ifdef HAVE_DLOPEN
!         {"getdlopenflags", sys_getdlopenflags, 1, 
!          getdlopenflags_doc},
  #endif
  #ifdef COUNT_ALLOCS
! 	{"getcounts",	sys_getcounts, 1},
  #endif
  #ifdef DYNAMIC_EXECUTION_PROFILE
! 	{"getdxp",	_Py_GetDXProfile, 1},
  #endif
  #ifdef Py_TRACE_REFS
! 	{"getobjects",	_Py_GetObjects, 1},
! 	{"gettotalrefcount", sys_gettotalrefcount, 1},
  #endif
! 	{"getrefcount",	sys_getrefcount, 1, getrefcount_doc},
! 	{"getrecursionlimit", sys_getrecursionlimit, 1,
  	 getrecursionlimit_doc},
! 	{"_getframe", sys_getframe, 1, getframe_doc},
  #ifdef USE_MALLOPT
! 	{"mdebug",	sys_mdebug, 1},
  #endif
! 	{"setdefaultencoding", sys_setdefaultencoding, 1,
  	 setdefaultencoding_doc}, 
! 	{"setcheckinterval",	sys_setcheckinterval, 1,
  	 setcheckinterval_doc}, 
  #ifdef HAVE_DLOPEN
!         {"setdlopenflags", sys_setdlopenflags, 1, 
!          setdlopenflags_doc},
  #endif
! 	{"setprofile",	sys_setprofile, 0, setprofile_doc},
! 	{"setrecursionlimit", sys_setrecursionlimit, 1,
  	 setrecursionlimit_doc},
! 	{"settrace",	sys_settrace, 0, settrace_doc},
  	{NULL,		NULL}		/* sentinel */
  };
--- 527,569 ----
  static PyMethodDef sys_methods[] = {
  	/* Might as well keep this in alphabetic order */
! 	{"displayhook",	sys_displayhook, METH_O, displayhook_doc},
! 	{"exc_info",	(PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc},
! 	{"excepthook",	sys_excepthook, METH_VARARGS, excepthook_doc},
! 	{"exit",	sys_exit, METH_OLDARGS, exit_doc},
! 	{"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS,
  	 getdefaultencoding_doc}, 
  #ifdef HAVE_DLOPEN
! 	{"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, 
! 	 getdlopenflags_doc},
  #endif
  #ifdef COUNT_ALLOCS
! 	{"getcounts",	(PyCFunction)sys_getcounts, METH_NOARGS},
  #endif
  #ifdef DYNAMIC_EXECUTION_PROFILE
! 	{"getdxp",	_Py_GetDXProfile, METH_VARARGS},
  #endif
  #ifdef Py_TRACE_REFS
! 	{"getobjects",	_Py_GetObjects, METH_VARARGS},
! 	{"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS},
  #endif
! 	{"getrefcount",	sys_getrefcount, METH_VARARGS, getrefcount_doc},
! 	{"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS,
  	 getrecursionlimit_doc},
! 	{"_getframe", sys_getframe, METH_VARARGS, getframe_doc},
  #ifdef USE_MALLOPT
! 	{"mdebug",	sys_mdebug, METH_VARARGS},
  #endif
! 	{"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS,
  	 setdefaultencoding_doc}, 
! 	{"setcheckinterval",	sys_setcheckinterval, METH_VARARGS,
  	 setcheckinterval_doc}, 
  #ifdef HAVE_DLOPEN
! 	{"setdlopenflags", sys_setdlopenflags, METH_VARARGS, 
! 	 setdlopenflags_doc},
  #endif
! 	{"setprofile",	sys_setprofile, METH_OLDARGS, setprofile_doc},
! 	{"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
  	 setrecursionlimit_doc},
! 	{"settrace",	sys_settrace, METH_OLDARGS, settrace_doc},
  	{NULL,		NULL}		/* sentinel */
  };