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 dholth
Recipients dholth
Date 2011-05-06.20:07:21
SpamBayes Score 2.0010775e-06
Marked as misclassified No
Message-id <1304712442.84.0.0469522790948.issue12022@psf.upfronthosting.co.za>
In-reply-to
Content
"How much do we care about special method lookup?" Python recently bypasses __getattr__ entirely when looking up context managers. http://mail.python.org/pipermail/python-dev/2009-May/089535.html

Could this be the reason that ZODB's transaction module, which attempts to be a context manager by declaring

manager = ThreadTransactionManager()
__enter__ = manager.get
__exit__ = manager.__exit__

Does not work in Python 2.7.1 on Ubuntu 11.04 or RHEL5? Frustratingly, the exception is no more specific than an AttributeError, even though hasattr(transaction, '__exit__')?

I would prefer to never get AttributeError: transaction.__exit__ when hasattr(transaction, '__exit__') as I find that to be very confusing. Maybe the interpreter could raise SpecialAttributeError('transaction.__exit__ is not sufficiently special') instead.

http://svn.zope.org/repos/main/transaction/trunk/transaction/__init__.py
History
Date User Action Args
2011-05-06 20:07:23dholthsetrecipients: + dholth
2011-05-06 20:07:22dholthsetmessageid: <1304712442.84.0.0469522790948.issue12022@psf.upfronthosting.co.za>
2011-05-06 20:07:21dholthlinkissue12022 messages
2011-05-06 20:07:21dholthcreate