Bugs item #1762972, was opened at 2007-07-28 23:24
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1762972&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Brett Cannon (bcannon)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: 'exec' does not accept what 'open' returns

Initial Comment:
Since the move over to io.py 'exec' no longer accepts what 'open' returns.  
Looks like there is a type check in 'exec' for strings, files, or code object, 
but 'open' returns a TextIOWrapper that fails that typecheck.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2007-08-03 16:26

Message:
Logged In: YES 
user_id=6380
Originator: NO

Arguably we don't need this feature any more.  The only reasonable way to
implement it would be to slurp the entire contents of the file into a
string and then exec that.  The caller might as well do this. 
Alternatively one could use execfile() (which takes a filename instead of a
stream).  The only advantage of using exec(<stream>) might be that it would
deal with encoding declarations transparantly; but we should probably have
a way to handle those somewhere in the library anyway, as it's also
necessary for other tools (e.g. modulefinder.py, pyclbr.py and
linecache.py).  Alternatively I'm not so sure that we will need to support
encoding declarations forever -- I'm hoping that at some point UTF-8 and
BOM+UTF-16 will take over the world.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1762972&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to