summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-25 08:29:14 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-25 08:29:14 (GMT)
commitd5b635f1969fdd609f0aff5669c9ec30e61be62e (patch)
tree1c854f8108e2b22d8c5ba4d529b6d99cd9f5f244 /Python
parent80055f6295dd48274ae68d13806c7ee3c5b5882f (diff)
downloadcpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.zip
cpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.tar.gz
cpython-d5b635f1969fdd609f0aff5669c9ec30e61be62e.tar.bz2
Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c2
-rw-r--r--Python/bltinmodule.c16
-rw-r--r--Python/ceval.c2
-rw-r--r--Python/sysmodule.c4
4 files changed, 14 insertions, 10 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 8a317b8..1fc2324 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1363,7 +1363,7 @@ ast_for_atom(struct compiling *c, const node *n)
expr_ty expression;
if (Py_Py3kWarningFlag) {
if (PyErr_WarnExplicit(PyExc_DeprecationWarning,
- "backquote not supported in 3.x",
+ "backquote not supported in 3.x; use repr()",
c->c_filename, LINENO(n),
NULL, NULL)) {
return NULL;
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3956bb5..c760dcb 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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);
diff --git a/Python/ceval.c b/Python/ceval.c
index dc1aa52..7c7116c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4056,7 +4056,7 @@ assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x)
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
#define CANNOT_CATCH_MSG "catching classes that don't inherit from " \
- "BaseException is not allowed in 3.x."
+ "BaseException is not allowed in 3.x"
static PyObject *
cmp_outcome(int op, register PyObject *v, register PyObject *w)
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 89e7e30..e733cee 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -174,8 +174,8 @@ sys_exc_clear(PyObject *self, PyObject *noargs)
if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning,
- "sys.exc_clear() not supported in 3.x. "
- "Use except clauses.") < 0)
+ "sys.exc_clear() not supported in 3.x; "
+ "use except clauses") < 0)
return NULL;
tstate = PyThreadState_GET();