Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv18062 Modified Files: classobject.c descrobject.c dictobject.c fileobject.c funcobject.c listobject.c sliceobject.c stringobject.c Log Message: SF patch #659536: Use PyArg_UnpackTuple where possible. Obtain cleaner coding and a system wide performance boost by using the fast, pre-parsed PyArg_Unpack function instead of PyArg_ParseTuple function which is driven by a format string. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -d -r2.166 -r2.167 *** classobject.c 12 Dec 2002 19:14:08 -0000 2.166 --- classobject.c 29 Dec 2002 16:33:11 -0000 2.167 *************** *** 2179,2183 **** PyObject *classObj; ! if (!PyArg_ParseTuple(args, "OOO:instancemethod", &func, &self, &classObj)) return NULL; --- 2179,2183 ---- PyObject *classObj; ! if (!PyArg_UnpackTuple(args, "instancemethod", 3, 3, &func, &self, &classObj)) return NULL; Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** descrobject.c 9 Dec 2002 22:56:13 -0000 2.32 --- descrobject.c 29 Dec 2002 16:33:11 -0000 2.33 *************** *** 687,691 **** PyObject *key, *def = Py_None; ! if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) return NULL; return PyObject_CallMethod(pp->dict, "get", "(OO)", key, def); --- 687,691 ---- PyObject *key, *def = Py_None; ! if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &def)) return NULL; return PyObject_CallMethod(pp->dict, "get", "(OO)", key, def); Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.137 retrieving revision 2.138 diff -C2 -d -r2.137 -r2.138 *** dictobject.c 11 Dec 2002 13:21:11 -0000 2.137 --- dictobject.c 29 Dec 2002 16:33:11 -0000 2.138 *************** *** 973,977 **** int status; ! if (!PyArg_ParseTuple(args, "O|O:fromkeys", &seq, &value)) return NULL; --- 973,977 ---- int status; ! if (!PyArg_UnpackTuple(args, "fromkeys", 1, 2, &seq, &value)) return NULL; *************** *** 1480,1484 **** long hash; ! if (!PyArg_ParseTuple(args, "O|O:get", &key, &failobj)) return NULL; --- 1480,1484 ---- long hash; ! if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; *************** *** 1506,1510 **** long hash; ! if (!PyArg_ParseTuple(args, "O|O:setdefault", &key, &failobj)) return NULL; --- 1506,1510 ---- long hash; ! if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) return NULL; *************** *** 1835,1839 **** int result = 0; ! if (!PyArg_ParseTuple(args, "|O:dict", &arg)) result = -1; --- 1835,1839 ---- int result = 0; ! if (!PyArg_UnpackTuple(args, "dict", 0, 1, &arg)) result = -1; Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.173 retrieving revision 2.174 diff -C2 -d -r2.173 -r2.174 *** fileobject.c 17 Dec 2002 17:48:00 -0000 2.173 --- fileobject.c 29 Dec 2002 16:33:11 -0000 2.174 *************** *** 504,508 **** return err_closed(); newsizeobj = NULL; ! if (!PyArg_ParseTuple(args, "|O:truncate", &newsizeobj)) return NULL; --- 504,508 ---- return err_closed(); newsizeobj = NULL; ! if (!PyArg_UnpackTuple(args, "truncate", 0, 1, &newsizeobj)) return NULL; Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** funcobject.c 11 Jul 2002 18:30:27 -0000 2.56 --- funcobject.c 29 Dec 2002 16:33:11 -0000 2.57 *************** *** 589,593 **** PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:classmethod", &callable)) return -1; Py_INCREF(callable); --- 589,593 ---- PyObject *callable; ! if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable)) return -1; Py_INCREF(callable); *************** *** 721,725 **** PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:staticmethod", &callable)) return -1; Py_INCREF(callable); --- 721,725 ---- PyObject *callable; ! if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable)) return -1; Py_INCREF(callable); Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** listobject.c 29 Dec 2002 05:49:09 -0000 2.143 --- listobject.c 29 Dec 2002 16:33:11 -0000 2.144 *************** *** 1655,1659 **** assert(self != NULL); if (args != NULL) { ! if (!PyArg_ParseTuple(args, "|O:sort", &compare)) return NULL; } --- 1655,1659 ---- assert(self != NULL); if (args != NULL) { ! if (!PyArg_UnpackTuple(args, "sort", 0, 1, &compare)) return NULL; } Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** sliceobject.c 6 Nov 2002 15:17:31 -0000 2.20 --- sliceobject.c 29 Dec 2002 16:33:11 -0000 2.21 *************** *** 175,179 **** start = stop = step = NULL; ! if (!PyArg_ParseTuple(args, "O|OO:slice", &start, &stop, &step)) return NULL; --- 175,179 ---- start = stop = step = NULL; ! if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) return NULL; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -d -r2.199 -r2.200 *** stringobject.c 12 Dec 2002 20:03:19 -0000 2.199 --- stringobject.c 29 Dec 2002 16:33:11 -0000 2.200 *************** *** 2047,2051 **** PyObject *tableobj, *delobj = NULL; ! if (!PyArg_ParseTuple(args, "O|O:translate", &tableobj, &delobj)) return NULL; --- 2047,2051 ---- PyObject *tableobj, *delobj = NULL; ! if (!PyArg_UnpackTuple(args, "translate", 1, 2, &tableobj, &delobj)) return NULL;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4