summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-04 18:52:26 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-04 18:52:26 (GMT)
commite92fba0a127c644e8159080623ab2efbf2457086 (patch)
tree73727123e7b65000ac2f363cc88303e899cc3219 /Python
parent1fc4b776d47b45133a2730d191552ec2f1928baa (diff)
downloadcpython-e92fba0a127c644e8159080623ab2efbf2457086.zip
cpython-e92fba0a127c644e8159080623ab2efbf2457086.tar.gz
cpython-e92fba0a127c644e8159080623ab2efbf2457086.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 1b2b829..9a1092c 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -36,8 +36,6 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
/* 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 @@ PyObject *
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 @@ PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals,
}
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)
{