mirror of
https://github.com/python/cpython.git
synced 2025-07-28 05:34:31 +00:00
Add a bunch more deprecation warnings for builtins that are going away in 3.0
This commit is contained in:
parent
c792629c83
commit
df25efeae9
1 changed files with 24 additions and 0 deletions
|
@ -191,6 +191,10 @@ Deprecated since release 2.3. Instead, use the extended call syntax:\n\
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_callable(PyObject *self, PyObject *v)
|
builtin_callable(PyObject *self, PyObject *v)
|
||||||
{
|
{
|
||||||
|
if (Py_Py3kWarningFlag &&
|
||||||
|
PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
|
"callable() not supported in 3.x") < 0)
|
||||||
|
return NULL;
|
||||||
return PyBool_FromLong((long)PyCallable_Check(v));
|
return PyBool_FromLong((long)PyCallable_Check(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +393,11 @@ builtin_coerce(PyObject *self, PyObject *args)
|
||||||
PyObject *v, *w;
|
PyObject *v, *w;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
|
||||||
|
if (Py_Py3kWarningFlag &&
|
||||||
|
PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
|
"coerce() not supported in 3.x") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w))
|
if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyNumber_Coerce(&v, &w) < 0)
|
if (PyNumber_Coerce(&v, &w) < 0)
|
||||||
|
@ -631,6 +640,11 @@ builtin_execfile(PyObject *self, PyObject *args)
|
||||||
PyCompilerFlags cf;
|
PyCompilerFlags cf;
|
||||||
int exists;
|
int exists;
|
||||||
|
|
||||||
|
if (Py_Py3kWarningFlag &&
|
||||||
|
PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
|
"execfile() not supported in 3.x") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s|O!O:execfile",
|
if (!PyArg_ParseTuple(args, "s|O!O:execfile",
|
||||||
&filename,
|
&filename,
|
||||||
&PyDict_Type, &globals,
|
&PyDict_Type, &globals,
|
||||||
|
@ -1800,6 +1814,11 @@ builtin_reduce(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *seq, *func, *result = NULL, *it;
|
PyObject *seq, *func, *result = NULL, *it;
|
||||||
|
|
||||||
|
if (Py_Py3kWarningFlag &&
|
||||||
|
PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
|
"reduce() not supported in 3.x") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
|
if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
|
@ -1872,6 +1891,11 @@ sequence is empty.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_reload(PyObject *self, PyObject *v)
|
builtin_reload(PyObject *self, PyObject *v)
|
||||||
{
|
{
|
||||||
|
if (Py_Py3kWarningFlag &&
|
||||||
|
PyErr_Warn(PyExc_DeprecationWarning,
|
||||||
|
"reload() not supported in 3.x") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return PyImport_ReloadModule(v);
|
return PyImport_ReloadModule(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue