Updates to the with-statement:
- New semantics for __exit__() -- it must re-raise the exception
if type is not None; the with-statement itself doesn't do this.
(See the updated PEP for motivation.)
- Added context managers to:
- file
- thread.LockType
- threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
- decimal.Context
- Added contextlib.py, which defines @contextmanager, nested(), closing().
- Unit tests all around; bot no docs yet.
diff --git a/Misc/NEWS b/Misc/NEWS
index 5599ba5..51e0aef 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,12 @@
with_statement``. Use of 'with' as a variable will generate a warning.
Use of 'as' as a variable will also generate a warning (unless it's
part of an import statement).
+ The following objects have __context__ methods:
+ - The built-in file type.
+ - The thread.LockType type.
+ - The following types defined by the threading module:
+ Lock, RLock, Condition, Semaphore, BoundedSemaphore.
+ - The decimal.Context class.
- Fix the encodings package codec search function to only search
inside its own package. Fixes problem reported in patch #1433198.
@@ -411,6 +417,9 @@
Library
-------
+- PEP 343: new module contextlib.py defines decorator @contextmanager
+ and helpful context managers nested() and closing().
+
- The compiler package now supports future imports after the module docstring.
- Bug #1413790: zipfile now sanitizes absolute archive names that are