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 ncoghlan
Recipients amaury.forgeotdarc, benjamin.peterson, christian.heimes, collinwinter, jyasskin, ncoghlan, nnorwitz, rhettinger
Date 2008-03-01.16:24:16
SpamBayes Score 0.17982984
Marked as misclassified No
Message-id <1204388658.02.0.0382301540889.issue2179@psf.upfronthosting.co.za>
In-reply-to
Content
A closer approximation of what the with statement is doing would be:

exit = lock.release()
lock.acquire()
try:
    pass
finally:
    exit()

The problem with trying to store the result of the retrieval of __exit__
on the stack is that we need to leave the context manager itself on top
of the stack for the next LOAD_ATTR opcode (when we're retrieving the
__enter__ method).

However, changing WITH_CLEANUP to take an argument indicating which
local variable holds the bound __exit__ method sounds like it might work.
History
Date User Action Args
2008-03-01 16:24:18ncoghlansetspambayes_score: 0.17983 -> 0.17982984
recipients: + ncoghlan, nnorwitz, collinwinter, rhettinger, amaury.forgeotdarc, christian.heimes, jyasskin, benjamin.peterson
2008-03-01 16:24:18ncoghlansetspambayes_score: 0.17983 -> 0.17983
messageid: <1204388658.02.0.0382301540889.issue2179@psf.upfronthosting.co.za>
2008-03-01 16:24:17ncoghlanlinkissue2179 messages
2008-03-01 16:24:17ncoghlancreate