Message135365
"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 |
|
Date |
User |
Action |
Args |
2011-05-06 20:07:23 | dholth | set | recipients:
+ dholth |
2011-05-06 20:07:22 | dholth | set | messageid: <1304712442.84.0.0469522790948.issue12022@psf.upfronthosting.co.za> |
2011-05-06 20:07:21 | dholth | link | issue12022 messages |
2011-05-06 20:07:21 | dholth | create | |
|