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 <>
"How much do we care about special method lookup?" Python recently bypasses __getattr__ entirely when looking up context managers.

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.
Date User Action Args
2011-05-06 20:07:23dholthsetrecipients: + dholth
2011-05-06 20:07:22dholthsetmessageid: <>
2011-05-06 20:07:21dholthlinkissue12022 messages
2011-05-06 20:07:21dholthcreate