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 j1m
Recipients j1m
Date 2010-07-10.19:52:28
SpamBayes Score 5.182508e-09
Marked as misclassified No
Message-id <1278791550.43.0.759341928181.issue9220@psf.upfronthosting.co.za>
In-reply-to
Content
In python 2.7 a module can't be used as a context manager.

For example, given the module, t.py:

    def __enter__(*args):
        print 'enter', args

    def __exit__(*args):
        print 'exit', args

In Python 2.6:

    >>> import t
    >>> with t: pass
    ... 
    enter ()
    exit (None, None, None)

In Python 2.7:

    >>> import t
    >>> with t: pass
    ... 
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: __exit__
History
Date User Action Args
2010-07-10 19:52:30j1msetrecipients: + j1m
2010-07-10 19:52:30j1msetmessageid: <1278791550.43.0.759341928181.issue9220@psf.upfronthosting.co.za>
2010-07-10 19:52:28j1mlinkissue9220 messages
2010-07-10 19:52:28j1mcreate