Armin Rigo added the comment:

I view this as a problem with Psyco, not with the user code.
An even deeper reason for which the general optimization would break
code is because it changes the lifetime of objects.  For example, Psyco
contains specific, user-requested support to make sure the following
kind of code works:

def myfunc():
    f = open('somewhere', 'r')
    fd = f.fileno()
    return os.fstat(fd)

At the moment Python guarantees that the file object is not closed
before the function exits.  The above code cannot be rewritten like this:

def bogus():
    fd = open('somewhere', 'r').fileno()
    # the file is auto-closed here and fd becomes invalid
    return os.fstat(fd)

I know it's bad style to write code relying on this property, but still
I want to make sure you are aware that it *will* introduce obscure
breakage in existing code.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2181>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to