Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 36737:fa92fe15251a legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 28 Feb 2006 21:57:43 +0000 |
| parents | e3248f1fc54d |
| children | 8e04de2480e4 |
comparison
equal
deleted
inserted
replaced
| 36736:bbce8ec2ff81 | 36737:fa92fe15251a |
|---|---|
| 22 PyThreadState *tstate = PyThreadState_GET(); | 22 PyThreadState *tstate = PyThreadState_GET(); |
| 23 PyObject *oldtype, *oldvalue, *oldtraceback; | 23 PyObject *oldtype, *oldvalue, *oldtraceback; |
| 24 | 24 |
| 25 if (traceback != NULL && !PyTraceBack_Check(traceback)) { | 25 if (traceback != NULL && !PyTraceBack_Check(traceback)) { |
| 26 /* XXX Should never happen -- fatal error instead? */ | 26 /* XXX Should never happen -- fatal error instead? */ |
| 27 /* Well, it could be None. */ | |
| 27 Py_DECREF(traceback); | 28 Py_DECREF(traceback); |
| 28 traceback = NULL; | 29 traceback = NULL; |
| 29 } | 30 } |
| 30 | 31 |
| 31 /* Save these in locals to safeguard against recursive | 32 /* Save these in locals to safeguard against recursive |
