diff options
author | Guido van Rossum <guido@python.org> | 2006-02-28 21:57:43 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-02-28 21:57:43 (GMT) |
commit | 1a5e21e0334a6d4e1c756575023c7157fc9ee306 (patch) | |
tree | d2c1c9383b3c6d8194449ae756e663b0b0ac9e4e /Misc | |
parent | 87a8b4fee56b8204ee9f7b0ce2e5db0564e8f86e (diff) | |
download | cpython-1a5e21e0334a6d4e1c756575023c7157fc9ee306.zip cpython-1a5e21e0334a6d4e1c756575023c7157fc9ee306.tar.gz cpython-1a5e21e0334a6d4e1c756575023c7157fc9ee306.tar.bz2 |
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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -36,6 +36,12 @@ Core and builtins 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 @@ Extension Modules 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 |