summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-05-26 17:43:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-05-26 17:43:53 (GMT)
commitdacde0d6ae72451ef102aa98ca36b733277d15bb (patch)
tree5fe8889292d15688bca575f2e208d544ec7562ff
parenteeb2b21ab0ecc3f10a51eea989ba6c2f1f01a9bd (diff)
downloadcpython-dacde0d6ae72451ef102aa98ca36b733277d15bb.zip
cpython-dacde0d6ae72451ef102aa98ca36b733277d15bb.tar.gz
cpython-dacde0d6ae72451ef102aa98ca36b733277d15bb.tar.bz2
turn PyErr_WarnPy3k into a macro
-rw-r--r--Include/warnings.h3
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/_warnings.c9
3 files changed, 3 insertions, 12 deletions
diff --git a/Include/warnings.h b/Include/warnings.h
index e761ade..79ef9f3 100644
--- a/Include/warnings.h
+++ b/Include/warnings.h
@@ -9,7 +9,8 @@ PyAPI_FUNC(void) _PyWarnings_Init(void);
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t);
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int,
const char *, PyObject *);
-PyAPI_FUNC(int) PyErr_WarnPy3k(const char *, Py_ssize_t);
+
+#define PyErr_WarnPy3k(msg, stacklevel) (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0)
/* DEPRECATED: Use PyErr_WarnEx() instead. */
#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
diff --git a/Misc/NEWS b/Misc/NEWS
index 3b5c240..4f1c3c7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -409,8 +409,7 @@ C API
which provide the functions through their libm. The files also
contains several helpers and constants for math.
-- Added a new convenience function, PyErr_WarnPy3k, for issuing Py3k
- warnings.
+- Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings.
What's New in Python 2.6 alpha 2?
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 9783745..0adb0c8 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -775,15 +775,6 @@ PyErr_WarnExplicit(PyObject *category, const char *text,
}
-int
-PyErr_WarnPy3k(const char *text, Py_ssize_t stacklevel)
-{
- if (Py_Py3kWarningFlag)
- return PyErr_WarnEx(PyExc_DeprecationWarning, text, stacklevel);
- return 0;
-}
-
-
PyDoc_STRVAR(warn_doc,
"Issue a warning, or maybe ignore it or raise an exception.");