diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-04-27 03:01:45 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-04-27 03:01:45 +0000 |
commit | 9f4f48114fbf2df3803a44a30cd14e11679403fe (patch) | |
tree | 701fc350aa3a6ebf282fdb92e891c793f65db0fb /Python | |
parent | a692c4df63a41c42f2ce10a4521136d1440a712d (diff) | |
download | cpython-git-9f4f48114fbf2df3803a44a30cd14e11679403fe.tar.gz |
Use PyErr_WarnPy3k throughout
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 38 | ||||
-rw-r--r-- | Python/ceval.c | 4 | ||||
-rw-r--r-- | Python/sysmodule.c | 6 |
3 files changed, 17 insertions, 31 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index bcdcda6355..5d191a63e0 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -165,10 +165,8 @@ builtin_apply(PyObject *self, PyObject *args) PyObject *func, *alist = NULL, *kwdict = NULL; PyObject *t = NULL, *retval = NULL; - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "apply() not supported in 3.x; " - "use func(*args, **kwargs)") < 0) + if (PyErr_WarnPy3k("apply() not supported in 3.x; " + "use func(*args, **kwargs)", 1) < 0) return NULL; if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) @@ -225,10 +223,8 @@ Return the binary representation of an integer or long integer."); static PyObject * builtin_callable(PyObject *self, PyObject *v) { - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "callable() not supported in 3.x; " - "use hasattr(o, '__call__')") < 0) + if (PyErr_WarnPy3k("callable() not supported in 3.x; " + "use hasattr(o, '__call__')", 1) < 0) return NULL; return PyBool_FromLong((long)PyCallable_Check(v)); } @@ -438,9 +434,7 @@ builtin_coerce(PyObject *self, PyObject *args) PyObject *v, *w; PyObject *res; - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "coerce() not supported in 3.x") < 0) + if (PyErr_WarnPy3k("coerce() not supported in 3.x", 1) < 0) return NULL; if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w)) @@ -709,9 +703,8 @@ builtin_execfile(PyObject *self, PyObject *args) PyCompilerFlags cf; int exists; - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "execfile() not supported in 3.x; use exec()") < 0) + if (PyErr_WarnPy3k("execfile() not supported in 3.x; use exec()", + 1) < 0) return NULL; if (!PyArg_ParseTuple(args, "s|O!O:execfile", @@ -937,10 +930,8 @@ builtin_map(PyObject *self, PyObject *args) n--; if (func == Py_None) { - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "map(None, ...) not supported in 3.x; " - "use list(...)") < 0) + if (PyErr_WarnPy3k("map(None, ...) not supported in 3.x; " + "use list(...)", 1) < 0) return NULL; if (n == 1) { /* map(None, S) is the same as list(S). */ @@ -1967,10 +1958,8 @@ builtin_reduce(PyObject *self, PyObject *args) { PyObject *seq, *func, *result = NULL, *it; - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "reduce() not supported in 3.x; " - "use functools.reduce()") < 0) + if (PyErr_WarnPy3k("reduce() not supported in 3.x; " + "use functools.reduce()", 1) < 0) return NULL; if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result)) @@ -2045,9 +2034,8 @@ sequence is empty."); static PyObject * builtin_reload(PyObject *self, PyObject *v) { - if (Py_Py3kWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, - "reload() not supported in 3.x; use imp.reload()") < 0) + if (PyErr_WarnPy3k("In 3.x, reload() is renamed to imp.reload()", + 1) < 0) return NULL; return PyImport_ReloadModule(v); diff --git a/Python/ceval.c b/Python/ceval.c index 7c7116ce41..c08585178c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3164,9 +3164,9 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) assert(PyExceptionClass_Check(type)); if (Py_Py3kWarningFlag && PyClass_Check(type)) { - if (PyErr_Warn(PyExc_DeprecationWarning, + if (PyErr_WarnEx(PyExc_DeprecationWarning, "exceptions must derive from BaseException " - "in 3.x") == -1) + "in 3.x", 1) == -1) goto raise_error; } diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 8c82d45d37..83d7d68bb2 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -172,10 +172,8 @@ sys_exc_clear(PyObject *self, PyObject *noargs) 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) + if (PyErr_WarnPy3k("sys.exc_clear() not supported in 3.x; " + "use except clauses", 1) < 0) return NULL; tstate = PyThreadState_GET(); |