Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 45983:99355baa748d legacy-trunk
#2358: add py3k warning to sys.exc_clear().
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Fri, 21 Mar 2008 20:11:46 +0000 |
| parents | 8fdd6d62ea55 |
| children | bfcda552492e |
line wrap: on
line diff
--- a/Python/sysmodule.c Fri Mar 21 20:01:51 2008 +0000 +++ b/Python/sysmodule.c Fri Mar 21 20:11:46 2008 +0000 @@ -169,8 +169,16 @@ static PyObject * sys_exc_clear(PyObject *self, PyObject *noargs) { - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate; PyObject *tmp_type, *tmp_value, *tmp_tb; + + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "sys.exc_clear() not supported in 3.x. " + "Use except clauses.") < 0) + return NULL; + + tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback;
