comparison 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
comparison
equal deleted inserted replaced
45981:85fbd1d265a2 45983:99355baa748d
167 ); 167 );
168 168
169 static PyObject * 169 static PyObject *
170 sys_exc_clear(PyObject *self, PyObject *noargs) 170 sys_exc_clear(PyObject *self, PyObject *noargs)
171 { 171 {
172 PyThreadState *tstate = PyThreadState_GET(); 172 PyThreadState *tstate;
173 PyObject *tmp_type, *tmp_value, *tmp_tb; 173 PyObject *tmp_type, *tmp_value, *tmp_tb;
174
175 if (Py_Py3kWarningFlag &&
176 PyErr_Warn(PyExc_DeprecationWarning,
177 "sys.exc_clear() not supported in 3.x. "
178 "Use except clauses.") < 0)
179 return NULL;
180
181 tstate = PyThreadState_GET();
174 tmp_type = tstate->exc_type; 182 tmp_type = tstate->exc_type;
175 tmp_value = tstate->exc_value; 183 tmp_value = tstate->exc_value;
176 tmp_tb = tstate->exc_traceback; 184 tmp_tb = tstate->exc_traceback;
177 tstate->exc_type = NULL; 185 tstate->exc_type = NULL;
178 tstate->exc_value = NULL; 186 tstate->exc_value = NULL;