id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	branch	branch_author	launchpad_bug
5129	Replace usage of execfile with t.p.compat version	thijs	itamar	"From [http://docs.pythonsprints.com/python3_porting/py-porting.html#execfile-statement porting-guide]: Starting with Python 3, the `execfile` statement is no longer available. An alternative is to use the `compile()` function in conjunction with `exec()`. `compile()` can create a code object from a file, and then it can be passed into `exec()`.

{{{
exec(compile(source_code, source_file_name, ""exec""))
}}}

Some of this work has been done by `loewis` in #4244, but that ticket focuses on getting `setup.py` to run in py3k, which involves more than `execfile` compatibility.

Currently these modules use `execfile`:

{{{
./setup.py:                execfile(setup_py, ns, ns)
./twisted/python/test/test_release.py:        execfile(""test_project"", ns)
./twisted/python/test/test_release.py:        execfile(""test_project"", ns)
./twisted/python/_release.py:        execfile(self.directory.child(""_version.py"").path, namespace)
./twisted/python/dist.py:    execfile(vfile, ns)
./twisted/web/script.py:        execfile(path, glob, glob)
./twisted/web/script.py:            execfile(self.filename, namespace, namespace)
./twisted/names/authority.py:        execfile(filename, g, l)
./twisted/lore/htmlbook.py:            execfile(filename)
}}}

where `lore/htmlbook.py` can be ignored because its being phased out, so small enough for this single ticket."	task	closed	low	Python-3.x	core	fixed	py3k	thijs facundobatista gavin@… vlada.peric@…	branches/py3-execfile-5129	exarkun, allenap	
