[Python-checkins] r42836 - python/trunk/Python/pythonrun.c

neal.norwitz python-checkins at python.org
Sat Mar 4 19:52:27 CET 2006


Author: neal.norwitz
Date: Sat Mar  4 19:52:26 2006
New Revision: 42836

Modified:
   python/trunk/Python/pythonrun.c
Log:
Get rid of run_err_mod().  It was only used in two places.
One place it wasn't necessary since mod was already checked.
Inline the check that mod != NULL for the other use.


Modified: python/trunk/Python/pythonrun.c
==============================================================================
--- python/trunk/Python/pythonrun.c	(original)
+++ python/trunk/Python/pythonrun.c	Sat Mar  4 19:52:26 2006
@@ -36,8 +36,6 @@
 /* Forward */
 static void initmain(void);
 static void initsite(void);
-static PyObject *run_err_mod(mod_ty, const char *, PyObject *, PyObject *,
-			      PyCompilerFlags *, PyArena *arena);
 static PyObject *run_mod(mod_ty, const char *, PyObject *, PyObject *,
 			  PyCompilerFlags *, PyArena *);
 static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *,
@@ -1159,11 +1157,12 @@
 PyRun_StringFlags(const char *str, int start, PyObject *globals, 
 		  PyObject *locals, PyCompilerFlags *flags)
 {
-	PyObject *ret;
+	PyObject *ret = NULL;
         PyArena *arena = PyArena_New();
 	mod_ty mod = PyParser_ASTFromString(str, "<string>", start, flags,
                                             arena);
-	ret = run_err_mod(mod, "<string>", globals, locals, flags, arena);
+	if (mod != NULL)
+		ret = run_mod(mod, "<string>", globals, locals, flags, arena);
         PyArena_Free(arena);
 	return ret;
 }
@@ -1182,21 +1181,12 @@
         }
 	if (closeit)
 		fclose(fp);
-	ret = run_err_mod(mod, filename, globals, locals, flags, arena);
+	ret = run_mod(mod, filename, globals, locals, flags, arena);
         PyArena_Free(arena);
 	return ret;
 }
 
 static PyObject *
-run_err_mod(mod_ty mod, const char *filename, PyObject *globals, 
-	    PyObject *locals, PyCompilerFlags *flags, PyArena *arena)
-{
-	if (mod == NULL)
-		return  NULL;
-	return run_mod(mod, filename, globals, locals, flags, arena);
-}
-
-static PyObject *
 run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
 	 PyCompilerFlags *flags, PyArena *arena)
 {


More information about the Python-checkins mailing list