Make Py3k warnings consistent w.r.t. punctuation; also respect the

EOL 80 limit and supply more alternatives in warning messages.
This commit is contained in:
Georg Brandl 2008-03-25 08:29:14 +00:00
parent 80055f6295
commit d5b635f196
16 changed files with 67 additions and 54 deletions

View file

@ -166,7 +166,8 @@ builtin_apply(PyObject *self, PyObject *args)
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"apply() not supported in 3.x. Use func(*args, **kwargs).") < 0)
"apply() not supported in 3.x; "
"use func(*args, **kwargs)") < 0)
return NULL;
if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict))
@ -225,7 +226,8 @@ builtin_callable(PyObject *self, PyObject *v)
{
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"callable() not supported in 3.x. Use hasattr(o, '__call__').") < 0)
"callable() not supported in 3.x; "
"use hasattr(o, '__call__')") < 0)
return NULL;
return PyBool_FromLong((long)PyCallable_Check(v));
}
@ -684,7 +686,7 @@ builtin_execfile(PyObject *self, PyObject *args)
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"execfile() not supported in 3.x. Use exec().") < 0)
"execfile() not supported in 3.x; use exec()") < 0)
return NULL;
if (!PyArg_ParseTuple(args, "s|O!O:execfile",
@ -912,7 +914,8 @@ builtin_map(PyObject *self, PyObject *args)
if (func == Py_None) {
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"map(None, ...) not supported in 3.x. Use list(...).") < 0)
"map(None, ...) not supported in 3.x; "
"use list(...)") < 0)
return NULL;
if (n == 1) {
/* map(None, S) is the same as list(S). */
@ -1934,7 +1937,8 @@ builtin_reduce(PyObject *self, PyObject *args)
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"reduce() not supported in 3.x") < 0)
"reduce() not supported in 3.x; "
"use functools.reduce()") < 0)
return NULL;
if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
@ -2011,7 +2015,7 @@ builtin_reload(PyObject *self, PyObject *v)
{
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
"reload() not supported in 3.x") < 0)
"reload() not supported in 3.x; use imp.reload()") < 0)
return NULL;
return PyImport_ReloadModule(v);