[Python-checkins] python/dist/src/Python importdl.c,2.69,2.70

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 26 Aug 2002 14:15:16 -0700


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

Modified Files:
	importdl.c 
Log Message:
Simplify, and avoid PyModule_GetDict() while we're at it.


Index: importdl.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/importdl.c,v
retrieving revision 2.69
retrieving revision 2.70
diff -C2 -d -r2.69 -r2.70
*** importdl.c	16 Oct 2001 20:07:34 -0000	2.69
--- importdl.c	26 Aug 2002 21:15:11 -0000	2.70
***************
*** 22,26 ****
  _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp)
  {
! 	PyObject *m, *d, *s;
  	char *lastdot, *shortname, *packagecontext, *oldcontext;
  	dl_funcptr p;
--- 22,26 ----
  _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp)
  {
! 	PyObject *m;
  	char *lastdot, *shortname, *packagecontext, *oldcontext;
  	dl_funcptr p;
***************
*** 65,73 ****
  	}
  	/* Remember the filename as the __file__ attribute */
! 	d = PyModule_GetDict(m);
! 	s = PyString_FromString(pathname);
! 	if (s == NULL || PyDict_SetItemString(d, "__file__", s) != 0)
  		PyErr_Clear(); /* Not important enough to report */
- 	Py_XDECREF(s);
  	if (Py_VerboseFlag)
  		PySys_WriteStderr(
--- 65,70 ----
  	}
  	/* Remember the filename as the __file__ attribute */
! 	if (PyModule_AddStringConstant(m, "__file__", pathname) < 0)
  		PyErr_Clear(); /* Not important enough to report */
  	if (Py_VerboseFlag)
  		PySys_WriteStderr(