[Python-3000-checkins] r56955 - in python/branches/py3k: Doc/api/exceptions.tex Include/pyerrors.h Modules/_bsddb.c Modules/_ctypes/callbacks.c Modules/mmapmodule.c Modules/posixmodule.c Objects/unicodeobject.c Python/errors.c Python/import.c Python/modsupport.c Python/structmember.c
skip.montanaro
python-3000-checkins at python.org
Sun Aug 12 13:44:54 CEST 2007
Author: skip.montanaro
Date: Sun Aug 12 13:44:53 2007
New Revision: 56955
Modified:
python/branches/py3k/Doc/api/exceptions.tex
python/branches/py3k/Include/pyerrors.h
python/branches/py3k/Modules/_bsddb.c
python/branches/py3k/Modules/_ctypes/callbacks.c
python/branches/py3k/Modules/mmapmodule.c
python/branches/py3k/Modules/posixmodule.c
python/branches/py3k/Objects/unicodeobject.c
python/branches/py3k/Python/errors.c
python/branches/py3k/Python/import.c
python/branches/py3k/Python/modsupport.c
python/branches/py3k/Python/structmember.c
Log:
PyErr_Warn is deprecated in 2.5 - goes away for 3.0
Modified: python/branches/py3k/Doc/api/exceptions.tex
==============================================================================
--- python/branches/py3k/Doc/api/exceptions.tex (original)
+++ python/branches/py3k/Doc/api/exceptions.tex Sun Aug 12 13:44:53 2007
@@ -296,16 +296,6 @@
command line documentation. There is no C API for warning control.
\end{cfuncdesc}
-\begin{cfuncdesc}{int}{PyErr_Warn}{PyObject *category, char *message}
- Issue a warning message. The \var{category} argument is a warning
- category (see below) or \NULL; the \var{message} argument is a
- message string. The warning will appear to be issued from the function
- calling \cfunction{PyErr_Warn()}, equivalent to calling
- \cfunction{PyErr_WarnEx()} with a \var{stacklevel} of 1.
-
- Deprecated; use \cfunction{PyErr_WarnEx()} instead.
-\end{cfuncdesc}
-
\begin{cfuncdesc}{int}{PyErr_WarnExplicit}{PyObject *category,
const char *message, const char *filename, int lineno,
const char *module, PyObject *registry}
Modified: python/branches/py3k/Include/pyerrors.h
==============================================================================
--- python/branches/py3k/Include/pyerrors.h (original)
+++ python/branches/py3k/Include/pyerrors.h Sun Aug 12 13:44:53 2007
@@ -213,9 +213,6 @@
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
const char *, int,
const char *, PyObject *);
-/* PyErr_Warn is only for backwards compatability and will be removed.
- Use PyErr_WarnEx instead. */
-#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
Modified: python/branches/py3k/Modules/_bsddb.c
==============================================================================
--- python/branches/py3k/Modules/_bsddb.c (original)
+++ python/branches/py3k/Modules/_bsddb.c Sun Aug 12 13:44:53 2007
@@ -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
Modified: python/branches/py3k/Modules/_ctypes/callbacks.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/callbacks.c (original)
+++ python/branches/py3k/Modules/_ctypes/callbacks.c Sun Aug 12 13:44:53 2007
@@ -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);
}
}
Modified: python/branches/py3k/Modules/mmapmodule.c
==============================================================================
--- python/branches/py3k/Modules/mmapmodule.c (original)
+++ python/branches/py3k/Modules/mmapmodule.c Sun Aug 12 13:44:53 2007
@@ -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);
Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c (original)
+++ python/branches/py3k/Modules/posixmodule.c Sun Aug 12 13:44:53 2007
@@ -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
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c (original)
+++ python/branches/py3k/Objects/unicodeobject.c Sun Aug 12 13:44:53 2007
@@ -5990,15 +5990,16 @@
if (!PyErr_ExceptionMatches(PyExc_UnicodeDecodeError))
return NULL;
PyErr_Clear();
- if (PyErr_Warn(PyExc_UnicodeWarning,
- (op == Py_EQ) ?
- "Unicode equal comparison "
- "failed to convert both arguments to Unicode - "
- "interpreting them as being unequal" :
- "Unicode unequal comparison "
- "failed to convert both arguments to Unicode - "
- "interpreting them as being unequal"
- ) < 0)
+ if (PyErr_WarnEx(PyExc_UnicodeWarning,
+ (op == Py_EQ) ?
+ "Unicode equal comparison "
+ "failed to convert both arguments to Unicode - "
+ "interpreting them as being unequal"
+ :
+ "Unicode unequal comparison "
+ "failed to convert both arguments to Unicode - "
+ "interpreting them as being unequal",
+ 1) < 0)
return NULL;
result = (op == Py_NE);
return PyBool_FromLong(result);
Modified: python/branches/py3k/Python/errors.c
==============================================================================
--- python/branches/py3k/Python/errors.c (original)
+++ python/branches/py3k/Python/errors.c Sun Aug 12 13:44:53 2007
@@ -670,17 +670,6 @@
}
}
-/* 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,
Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c (original)
+++ python/branches/py3k/Python/import.c Sun Aug 12 13:44:53 2007
@@ -1320,8 +1320,8 @@
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 @@
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;
}
}
Modified: python/branches/py3k/Python/modsupport.c
==============================================================================
--- python/branches/py3k/Python/modsupport.c (original)
+++ python/branches/py3k/Python/modsupport.c Sun Aug 12 13:44:53 2007
@@ -42,7 +42,7 @@
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.
Modified: python/branches/py3k/Python/structmember.c
==============================================================================
--- python/branches/py3k/Python/structmember.c (original)
+++ python/branches/py3k/Python/structmember.c Sun Aug 12 13:44:53 2007
@@ -90,10 +90,10 @@
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
More information about the Python-3000-checkins
mailing list