This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arigo
Recipients arigo, nnorwitz
Date 2008-02-28.13:45:49
SpamBayes Score 0.0025705262
Marked as misclassified No
Message-id <1204206351.52.0.885541639854.issue2181@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-02-28 13:45:51arigosetspambayes_score: 0.00257053 -> 0.0025705262
recipients: + arigo, nnorwitz
2008-02-28 13:45:51arigosetspambayes_score: 0.00257053 -> 0.00257053
messageid: <1204206351.52.0.885541639854.issue2181@psf.upfronthosting.co.za>
2008-02-28 13:45:50arigolinkissue2181 messages
2008-02-28 13:45:49arigocreate