-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
Does not below two ways equal?
class Foo(object):
def __enter__(self):
print "hello, world"
def __exit__(self, type, value, tb):
print "bye"
with Foo() as foo:
pass
mgr = Foo()
exit = type(mgr).__exit__
value = type(mgr).__enter__(mgr)
exc = True
try:
try:
foo = value
pass
except:
exc = False
if not exit(mgr, *sys.exc_info()):
raise
finally:
if exc:
exit(mgr, None, None, None)Metadata
Metadata
Assignees
Labels
No labels