summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-21 20:11:46 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-21 20:11:46 (GMT)
commit5a44424c5e6b9533b12773fadeaf436903ca855e (patch)
tree798911139fbccc6a8574ed0e13388affea097082 /Python/sysmodule.c
parent77354cf5ef9644121a28041216591762628d8b65 (diff)
downloadcpython-5a44424c5e6b9533b12773fadeaf436903ca855e.zip
cpython-5a44424c5e6b9533b12773fadeaf436903ca855e.tar.gz
cpython-5a44424c5e6b9533b12773fadeaf436903ca855e.tar.bz2
#2358: add py3k warning to sys.exc_clear().
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 8e27844..385969f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -169,8 +169,16 @@ clause in the current stack frame or in an older stack frame."
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;