Kaydet (Commit) b93e7d16 authored tarafından Neal Norwitz's avatar Neal Norwitz

Add a little info to the 3k deprecation warnings about what to use instead.

Suggested by Raymond Hettinger.
üst e7b53c52
...@@ -166,7 +166,7 @@ builtin_apply(PyObject *self, PyObject *args) ...@@ -166,7 +166,7 @@ builtin_apply(PyObject *self, PyObject *args)
if (Py_Py3kWarningFlag && if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning, PyErr_Warn(PyExc_DeprecationWarning,
"apply() not supported in 3.x") < 0) "apply() not supported in 3.x. Use func(*args, **kwargs).") < 0)
return NULL; return NULL;
if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict))
...@@ -225,7 +225,7 @@ builtin_callable(PyObject *self, PyObject *v) ...@@ -225,7 +225,7 @@ builtin_callable(PyObject *self, PyObject *v)
{ {
if (Py_Py3kWarningFlag && if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning, PyErr_Warn(PyExc_DeprecationWarning,
"callable() not supported in 3.x") < 0) "callable() not supported in 3.x. Use hasattr(o, '__call__').") < 0)
return NULL; return NULL;
return PyBool_FromLong((long)PyCallable_Check(v)); return PyBool_FromLong((long)PyCallable_Check(v));
} }
...@@ -684,7 +684,7 @@ builtin_execfile(PyObject *self, PyObject *args) ...@@ -684,7 +684,7 @@ builtin_execfile(PyObject *self, PyObject *args)
if (Py_Py3kWarningFlag && if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning, PyErr_Warn(PyExc_DeprecationWarning,
"execfile() not supported in 3.x") < 0) "execfile() not supported in 3.x. Use exec().") < 0)
return NULL; return NULL;
if (!PyArg_ParseTuple(args, "s|O!O:execfile", if (!PyArg_ParseTuple(args, "s|O!O:execfile",
...@@ -912,7 +912,7 @@ builtin_map(PyObject *self, PyObject *args) ...@@ -912,7 +912,7 @@ builtin_map(PyObject *self, PyObject *args)
if (func == Py_None) { if (func == Py_None) {
if (Py_Py3kWarningFlag && if (Py_Py3kWarningFlag &&
PyErr_Warn(PyExc_DeprecationWarning, PyErr_Warn(PyExc_DeprecationWarning,
"map(None, ...) not supported in 3.x") < 0) "map(None, ...) not supported in 3.x. Use list(...).") < 0)
return NULL; return NULL;
if (n == 1) { if (n == 1) {
/* map(None, S) is the same as list(S). */ /* map(None, S) is the same as list(S). */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment