[Python-checkins] python/dist/src/Python bltinmodule.c, 2.297,
2.298 ceval.c, 2.367, 2.368 compile.c, 2.295, 2.296 errors.c,
2.78, 2.79 exceptions.c, 1.47, 1.48 pythonrun.c, 2.197, 2.198
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sun Oct 12 15:09:40 EDT 2003
- Previous message: [Python-checkins] python/dist/src/Objects classobject.c, 2.171,
2.172 complexobject.c, 2.69, 2.70 fileobject.c, 2.183,
2.184 typeobject.c, 2.248, 2.249
- Next message: [Python-checkins] python/dist/src/Mac/Tools/IDE PyConsole.py, 1.17,
1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv411/Python
Modified Files:
bltinmodule.c ceval.c compile.c errors.c exceptions.c
pythonrun.c
Log Message:
Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.297
retrieving revision 2.298
diff -C2 -d -r2.297 -r2.298
*** bltinmodule.c 16 Sep 2003 03:17:16 -0000 2.297
--- bltinmodule.c 12 Oct 2003 19:09:37 -0000 2.298
***************
*** 324,328 ****
if (PyNumber_Coerce(&v, &w) < 0)
return NULL;
! res = Py_BuildValue("(OO)", v, w);
Py_DECREF(v);
Py_DECREF(w);
--- 324,328 ----
if (PyNumber_Coerce(&v, &w) < 0)
return NULL;
! res = PyTuple_Pack(2, v, w);
Py_DECREF(v);
Py_DECREF(w);
***************
*** 2186,2190 ****
}
else {
! PyObject *arg = Py_BuildValue("(O)", item);
if (arg == NULL) {
Py_DECREF(item);
--- 2186,2190 ----
}
else {
! PyObject *arg = PyTuple_Pack(1, item);
if (arg == NULL) {
Py_DECREF(item);
***************
*** 2253,2257 ****
} else {
PyObject *arg, *good;
! arg = Py_BuildValue("(O)", item);
if (arg == NULL) {
Py_DECREF(item);
--- 2253,2257 ----
} else {
PyObject *arg, *good;
! arg = PyTuple_Pack(1, item);
if (arg == NULL) {
Py_DECREF(item);
***************
*** 2347,2351 ****
ok = 1;
} else {
! arg = Py_BuildValue("(O)", item);
if (arg == NULL) {
Py_DECREF(item);
--- 2347,2351 ----
ok = 1;
} else {
! arg = PyTuple_Pack(1, item);
if (arg == NULL) {
Py_DECREF(item);
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.367
retrieving revision 2.368
diff -C2 -d -r2.367 -r2.368
*** ceval.c 29 Jun 2003 14:48:32 -0000 2.367
--- ceval.c 12 Oct 2003 19:09:37 -0000 2.368
***************
*** 1474,1478 ****
}
if (err == 0) {
! x = Py_BuildValue("(O)", v);
if (x == NULL)
err = -1;
--- 1474,1478 ----
}
if (err == 0) {
! x = PyTuple_Pack(1, v);
if (x == NULL)
err = -1;
***************
*** 1982,1986 ****
}
u = TOP();
! w = Py_BuildValue("(OOOO)",
w,
f->f_globals,
--- 1982,1986 ----
}
u = TOP();
! w = PyTuple_Pack(4,
w,
f->f_globals,
***************
*** 3000,3004 ****
Py_INCREF(value);
}
! arg = Py_BuildValue("(OOO)", type, value, traceback);
if (arg == NULL) {
PyErr_Restore(type, value, traceback);
--- 3000,3004 ----
Py_INCREF(value);
}
! arg = PyTuple_Pack(3, type, value, traceback);
if (arg == NULL) {
PyErr_Restore(type, value, traceback);
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.295
retrieving revision 2.296
diff -C2 -d -r2.295 -r2.296
*** compile.c 22 Sep 2003 04:26:44 -0000 2.295
--- compile.c 12 Oct 2003 19:09:37 -0000 2.296
***************
*** 611,615 ****
if (t == NULL)
goto exit;
! w = Py_BuildValue("(OO)", v, t);
if (w == NULL)
goto exit;
--- 611,615 ----
if (t == NULL)
goto exit;
! w = PyTuple_Pack(2, v, t);
if (w == NULL)
goto exit;
***************
*** 970,974 ****
long n;
! t = Py_BuildValue("(OO)", v, v->ob_type);
if (t == NULL)
goto fail;
--- 970,974 ----
long n;
! t = PyTuple_Pack(2, v, v->ob_type);
if (t == NULL)
goto fail;
Index: errors.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v
retrieving revision 2.78
retrieving revision 2.79
diff -C2 -d -r2.78 -r2.79
*** errors.c 15 Jul 2003 23:03:55 -0000 2.78
--- errors.c 12 Oct 2003 19:09:37 -0000 2.79
***************
*** 160,164 ****
if (value == Py_None)
! args = Py_BuildValue("()");
else if (PyTuple_Check(value)) {
Py_INCREF(value);
--- 160,164 ----
if (value == Py_None)
! args = PyTuple_New(0);
else if (PyTuple_Check(value)) {
Py_INCREF(value);
***************
*** 166,170 ****
}
else
! args = Py_BuildValue("(O)", value);
if (args == NULL)
--- 166,170 ----
}
else
! args = PyTuple_Pack(1, value);
if (args == NULL)
***************
*** 561,565 ****
if (classname == NULL)
goto failure;
! bases = Py_BuildValue("(O)", base);
if (bases == NULL)
goto failure;
--- 561,565 ----
if (classname == NULL)
goto failure;
! bases = PyTuple_Pack(1, base);
if (bases == NULL)
goto failure;
Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** exceptions.c 14 Aug 2003 20:59:07 -0000 1.47
--- exceptions.c 12 Oct 2003 19:09:37 -0000 1.48
***************
*** 1822,1826 ****
/* Now we need to pre-allocate a MemoryError instance */
! args = Py_BuildValue("()");
if (!args ||
!(PyExc_MemoryErrorInst = PyEval_CallObject(PyExc_MemoryError, args)))
--- 1822,1826 ----
/* Now we need to pre-allocate a MemoryError instance */
! args = PyTuple_New(0);
if (!args ||
!(PyExc_MemoryErrorInst = PyEval_CallObject(PyExc_MemoryError, args)))
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.197
retrieving revision 2.198
diff -C2 -d -r2.197 -r2.198
*** pythonrun.c 11 Aug 2003 12:20:24 -0000 2.197
--- pythonrun.c 12 Oct 2003 19:09:37 -0000 2.198
***************
*** 1038,1042 ****
hook = PySys_GetObject("excepthook");
if (hook) {
! PyObject *args = Py_BuildValue("(OOO)",
exception, v ? v : Py_None, tb ? tb : Py_None);
PyObject *result = PyEval_CallObject(hook, args);
--- 1038,1042 ----
hook = PySys_GetObject("excepthook");
if (hook) {
! PyObject *args = PyTuple_Pack(3,
exception, v ? v : Py_None, tb ? tb : Py_None);
PyObject *result = PyEval_CallObject(hook, args);
- Previous message: [Python-checkins] python/dist/src/Objects classobject.c, 2.171,
2.172 complexobject.c, 2.69, 2.70 fileobject.c, 2.183,
2.184 typeobject.c, 2.248, 2.249
- Next message: [Python-checkins] python/dist/src/Mac/Tools/IDE PyConsole.py, 1.17,
1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list