[Python-3000-checkins] r56940 - in python/branches/py3k: Demo/scripts/newslist.py Demo/scripts/pp.py Doc/dist/dist.tex Doc/howto/doanddont.tex Doc/lib/libdoctest.tex Doc/lib/libexcs.tex Doc/lib/libfuncs.tex Doc/lib/libuser.tex Doc/ref/ref4.tex Do
Neal Norwitz
nnorwitz at gmail.com
Sun Aug 12 19:12:22 CEST 2007
On 8/12/07, Georg Brandl <g.brandl at gmx.net> wrote:
> neal.norwitz schrieb:
> > Author: neal.norwitz
> > Date: Sun Aug 12 02:43:29 2007
> > New Revision: 56940
>
> > Log:
> > Kill execfile(), use exec() instead
>
> > Modified: python/branches/py3k/Demo/scripts/newslist.py
> > =======================================
> > --- python/branches/py3k/Demo/scripts/newslist.py (original)
> > +++ python/branches/py3k/Demo/scripts/newslist.py Sun Aug 12 02:43:29 2007
> > @@ -99,7 +99,7 @@
> > rcfile = os.path.join(dir, '.newslistrc.py')
> > if os.path.exists(rcfile):
> > print(rcfile)
> > - execfile(rcfile)
> > + exec(open(rcfile).read())
> > break
>
> Doesn't exec() support file objects directly?
Hmmm, is it supposed to? Seems like a fine interface and I see that
the doc mentions it as well as the error message. But it doesn't
work.
>>> exec(open('nn.py'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: exec() arg 1 must be a string, file, or code object, not
TextIOWrapper
We should add tests for this, fix the exec() code, update everything
from this change and fix the fixer in 2to3. I'll add this to a bug
report so we don't lose it.
http://python.org/sf/1772686
n
More information about the Python-3000-checkins
mailing list