[Python-Dev] Py2.5 issue: decimal context manager misimplemented, misdesigned, and misdocumented

Raymond Hettinger rhettinger at ewtllc.com
Fri Sep 1 19:56:17 CEST 2006

>>> The right way to do it was presented in PEP343.  The implementation 
>>> was correct and the API was simple.
>> Raymond's persuaded me that he's right on the API part at the very 
>> least. The current API was a mechanical replacement of the initial 
>> __context__ based API with a normal method, whereas I should have 
>> reverted back to the module-level localcontext() function from PEP343 
>> and thrown the method on Context objects away entirely.
>> I can fix it on the trunk (and add those missing tests!), but I'll 
>> need Anthony and/or Neal's permission to backport it and remove the 
>> get_manager() method from Python 2.5 before we get stuck with it 
>> forever.
> I committed this fix as 51664 on the trunk (although the docstrings 
> are still example free because doctest doesn't understand __future__ 
> statements).

Thanks for getting this done.

Please make the following changes:
* rename ContextManger to _ContextManger and remove it from the __all__ 
* move the copy() step from localcontext() to _ContextManager()
* make the trivial updates the whatsnew25 example

Once those nits are fixed, I recommend this patch be backported to the 
Py2.5 release.


More information about the Python-Dev mailing list