comparison Python/bltinmodule.c @ 51246:0162cd4f55be 3.0

Merged revisions 69184 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r69184 | mark.dickinson | 2009-02-01 12:13:56 +0000 (Sun, 01 Feb 2009) | 3 lines Issue #1717: remove the cmp builtin function, the C-API functions PyObject_Cmp, PyObject_Compare, and various support functions. ........
author Mark Dickinson <dickinsm@gmail.com>
date Sun, 01 Feb 2009 12:31:56 +0000
parents 9c1f06b273f7
children 87fbbf22adf3
comparison
equal deleted inserted replaced
51244:e9675d72e3e3 51246:0162cd4f55be
492 ) 492 )
493 #endif 493 #endif
494 ; 494 ;
495 495
496 496
497 static PyObject *
498 builtin_cmp(PyObject *self, PyObject *args)
499 {
500 PyObject *a, *b;
501 int c;
502
503 if (!PyArg_UnpackTuple(args, "cmp", 2, 2, &a, &b))
504 return NULL;
505 if (PyObject_Cmp(a, b, &c) < 0)
506 return NULL;
507 return PyLong_FromLong((long)c);
508 }
509
510 PyDoc_STRVAR(cmp_doc,
511 "cmp(x, y) -> integer\n\
512 \n\
513 Return negative if x<y, zero if x==y, positive if x>y.");
514
515
516 static char * 497 static char *
517 source_as_string(PyObject *cmd, char *funcname, char *what) 498 source_as_string(PyObject *cmd, char *funcname, char *what)
518 { 499 {
519 char *str; 500 char *str;
520 Py_ssize_t size; 501 Py_ssize_t size;
2231 {"all", builtin_all, METH_O, all_doc}, 2212 {"all", builtin_all, METH_O, all_doc},
2232 {"any", builtin_any, METH_O, any_doc}, 2213 {"any", builtin_any, METH_O, any_doc},
2233 {"ascii", builtin_ascii, METH_O, ascii_doc}, 2214 {"ascii", builtin_ascii, METH_O, ascii_doc},
2234 {"bin", builtin_bin, METH_O, bin_doc}, 2215 {"bin", builtin_bin, METH_O, bin_doc},
2235 {"chr", builtin_chr, METH_VARARGS, chr_doc}, 2216 {"chr", builtin_chr, METH_VARARGS, chr_doc},
2236 {"cmp", builtin_cmp, METH_VARARGS, cmp_doc},
2237 {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, 2217 {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc},
2238 {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, 2218 {"delattr", builtin_delattr, METH_VARARGS, delattr_doc},
2239 {"dir", builtin_dir, METH_VARARGS, dir_doc}, 2219 {"dir", builtin_dir, METH_VARARGS, dir_doc},
2240 {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, 2220 {"divmod", builtin_divmod, METH_VARARGS, divmod_doc},
2241 {"eval", builtin_eval, METH_VARARGS, eval_doc}, 2221 {"eval", builtin_eval, METH_VARARGS, eval_doc},