[Python-checkins] CVS: python/dist/src/Python import.c,2.189,2.190

Fred L. Drake fdrake@users.sourceforge.net
2001年10月25日 14:39:01 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv28405
Modified Files:
	import.c 
Log Message:
Use PyDict_Copy() and PyDict_Update() instead of using PyObject_CallMethod()
to call the corresponding methods. This is not a performance improvement
since the times are still swamped by disk I/O, but cleans up the code just
a little.
Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.189
retrieving revision 2.190
diff -C2 -d -r2.189 -r2.190
*** import.c	2001年10月24日 20:42:55	2.189
--- import.c	2001年10月25日 21:38:59	2.190
***************
*** 393,397 ****
 	if (dict == NULL)
 		return NULL;
! 	copy = PyObject_CallMethod(dict, "copy", "");
 	if (copy == NULL)
 		return NULL;
--- 393,397 ----
 	if (dict == NULL)
 		return NULL;
! 	copy = PyDict_Copy(dict);
 	if (copy == NULL)
 		return NULL;
***************
*** 404,408 ****
 _PyImport_FindExtension(char *name, char *filename)
 {
! 	PyObject *dict, *mod, *mdict, *result;
 	if (extensions == NULL)
 		return NULL;
--- 404,408 ----
 _PyImport_FindExtension(char *name, char *filename)
 {
! 	PyObject *dict, *mod, *mdict;
 	if (extensions == NULL)
 		return NULL;
***************
*** 416,423 ****
 	if (mdict == NULL)
 		return NULL;
! 	result = PyObject_CallMethod(mdict, "update", "O", dict);
! 	if (result == NULL)
 		return NULL;
- 	Py_DECREF(result);
 	if (Py_VerboseFlag)
 		PySys_WriteStderr("import %s # previously loaded (%s)\n",
--- 416,421 ----
 	if (mdict == NULL)
 		return NULL;
! 	if (PyDict_Update(mdict, dict))
 		return NULL;
 	if (Py_VerboseFlag)
 		PySys_WriteStderr("import %s # previously loaded (%s)\n",

AltStyle によって変換されたページ (->オリジナル) /