Nick Coghlan added the comment:

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.

----------
nosy: +ncoghlan

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

Reply via email to