mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
PyErr_Warn is deprecated in 2.5 - goes away for 3.0
This commit is contained in:
parent
447e7c3981
commit
46fc337395
11 changed files with 40 additions and 55 deletions
|
@ -670,17 +670,6 @@ PyErr_WarnEx(PyObject *category, const char *message, Py_ssize_t stack_level)
|
|||
}
|
||||
}
|
||||
|
||||
/* PyErr_Warn is only for backwards compatability and will be removed.
|
||||
Use PyErr_WarnEx instead. */
|
||||
|
||||
#undef PyErr_Warn
|
||||
|
||||
PyAPI_FUNC(int)
|
||||
PyErr_Warn(PyObject *category, char *message)
|
||||
{
|
||||
return PyErr_WarnEx(category, message, 1);
|
||||
}
|
||||
|
||||
/* Warning with explicit origin */
|
||||
int
|
||||
PyErr_WarnExplicit(PyObject *category, const char *message,
|
||||
|
|
|
@ -1320,8 +1320,8 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
|||
sprintf(warnstr, "Not importing directory "
|
||||
"'%.*s': missing __init__.py",
|
||||
MAXPATHLEN, buf);
|
||||
if (PyErr_Warn(PyExc_ImportWarning,
|
||||
warnstr)) {
|
||||
if (PyErr_WarnEx(PyExc_ImportWarning,
|
||||
warnstr, 1)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1339,8 +1339,8 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
|||
sprintf(warnstr, "Not importing directory "
|
||||
"'%.*s': missing __init__.py",
|
||||
MAXPATHLEN, buf);
|
||||
if (PyErr_Warn(PyExc_ImportWarning,
|
||||
warnstr)) {
|
||||
if (PyErr_WarnEx(PyExc_ImportWarning,
|
||||
warnstr, 1)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
|
|||
api_version_warning, name,
|
||||
PYTHON_API_VERSION, name,
|
||||
module_api_version);
|
||||
if (PyErr_Warn(PyExc_RuntimeWarning, message))
|
||||
if (PyErr_WarnEx(PyExc_RuntimeWarning, message, 1))
|
||||
return NULL;
|
||||
}
|
||||
/* Make sure name is fully qualified.
|
||||
|
|
|
@ -90,10 +90,10 @@ PyMember_GetOne(const char *addr, PyMemberDef *l)
|
|||
return v;
|
||||
}
|
||||
|
||||
#define WARN(msg) \
|
||||
do { \
|
||||
if (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) \
|
||||
return -1; \
|
||||
#define WARN(msg) \
|
||||
do { \
|
||||
if (PyErr_WarnEx(PyExc_RuntimeWarning, msg, 1) < 0) \
|
||||
return -1; \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue