summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-12 23:30:11 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-12 23:30:11 (GMT)
commitda5b8f2d28f2f7ce47be5d88244eaefc66f7de3e (patch)
treef3b0ab1f90be8ba18b1cefdb660cebd95c0f70d9 /Python/bltinmodule.c
parent2d5c219fe09eacf81c139e5af9114fbbdd093d85 (diff)
downloadcpython-da5b8f2d28f2f7ce47be5d88244eaefc66f7de3e.zip
cpython-da5b8f2d28f2f7ce47be5d88244eaefc66f7de3e.tar.gz
cpython-da5b8f2d28f2f7ce47be5d88244eaefc66f7de3e.tar.bz2
Rip out the file object's implementation.
Fixed test_import.py while I was at it. However, there's still a problem in import.c -- get_file() can leak a FILE struct (not a file descriptor though). I'm not sure how to fix this; closing the FILE* closes the file descriptor, and that's the wrong thing to do when there's still a Python file object keeping the file descriptor open. I also would rather not mess with dup(), as it won't port to Windows.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index d4c8a74..3b43ff9 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -659,8 +659,7 @@ builtin_exec(PyObject *self, PyObject *args)
locals = globals;
if (!PyString_Check(prog) &&
!PyUnicode_Check(prog) &&
- !PyCode_Check(prog) &&
- !PyFile_Check(prog)) {
+ !PyCode_Check(prog)) {
PyErr_Format(PyExc_TypeError,
"exec() arg 1 must be a string, file, or code "
"object, not %.100s", prog->ob_type->tp_name);
@@ -692,18 +691,6 @@ builtin_exec(PyObject *self, PyObject *args)
}
v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals);
}
- else if (PyFile_Check(prog)) {
- FILE *fp = PyFile_AsFile(prog);
- char *name = PyString_AsString(PyFile_Name(prog));
- PyCompilerFlags cf;
- cf.cf_flags = 0;
- if (PyEval_MergeCompilerFlags(&cf))
- v = PyRun_FileFlags(fp, name, Py_file_input, globals,
- locals, &cf);
- else
- v = PyRun_File(fp, name, Py_file_input, globals,
- locals);
- }
else {
char *str = source_as_string(prog);
PyCompilerFlags cf;