PyErr_Warn is deprecated in 2.5 - goes away for 3.0
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index d03999f..149cd98 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -546,7 +546,7 @@
}
_db_errmsg[0] = 0;
#ifdef HAVE_WARNINGS
- exceptionRaised = PyErr_Warn(PyExc_RuntimeWarning, errTxt);
+ exceptionRaised = PyErr_WarnEx(PyExc_RuntimeWarning, errTxt, 1);
#else
fprintf(stderr, errTxt);
fprintf(stderr, "\n");
@@ -859,8 +859,10 @@
MYDB_END_ALLOW_THREADS;
#ifdef HAVE_WARNINGS
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
- "DB could not be closed in destructor: DBEnv already closed");
+ PyErr_WarnEx(PyExc_RuntimeWarning,
+ "DB could not be closed in destructor:"
+ " DBEnv already closed",
+ 1);
#endif
}
self->db = NULL;
@@ -1031,8 +1033,10 @@
txn_abort(self->txn);
#endif
MYDB_END_ALLOW_THREADS;
- PyErr_Warn(PyExc_RuntimeWarning,
- "DBTxn aborted in destructor. No prior commit() or abort().");
+ PyErr_WarnEx(PyExc_RuntimeWarning,
+ "DBTxn aborted in destructor. "
+ " No prior commit() or abort().",
+ 1);
}
#endif
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 5915455..a1a0e0d 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -225,8 +225,9 @@
else if (keep == Py_None) /* Nothing to keep */
Py_DECREF(keep);
else if (setfunc != getentry("O")->setfunc) {
- if (-1 == PyErr_Warn(PyExc_RuntimeWarning,
- "memory leak in callback function."))
+ if (-1 == PyErr_WarnEx(PyExc_RuntimeWarning,
+ "memory leak in callback function.",
+ 1))
PyErr_WriteUnraisable(callable);
}
}
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 269ac90..1626d72 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -998,8 +998,9 @@
XXX: fileno == 0 is a valid fd, but was accepted prior to 2.5.
XXX: Should this code be added?
if (fileno == 0)
- PyErr_Warn(PyExc_DeprecationWarning,
- "don't use 0 for anonymous memory");
+ PyErr_WarnEx(PyExc_DeprecationWarning,
+ "don't use 0 for anonymous memory",
+ 1);
*/
if (fileno != -1 && fileno != 0) {
fh = (HANDLE)_get_osfhandle(fileno);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 61ac4e6..d710a73 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5344,8 +5344,9 @@
if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx))
return NULL;
- if (PyErr_Warn(PyExc_RuntimeWarning,
- "tempnam is a potential security risk to your program") < 0)
+ if (PyErr_WarnEx(PyExc_RuntimeWarning,
+ "tempnam is a potential security risk to your program",
+ 1) < 0)
return NULL;
#ifdef MS_WINDOWS
@@ -5391,8 +5392,9 @@
char buffer[L_tmpnam];
char *name;
- if (PyErr_Warn(PyExc_RuntimeWarning,
- "tmpnam is a potential security risk to your program") < 0)
+ if (PyErr_WarnEx(PyExc_RuntimeWarning,
+ "tmpnam is a potential security risk to your program",
+ 1) < 0)
return NULL;
#ifdef USE_TMPNAM_R