]> granicus.if.org Git - python/commitdiff
turn PyErr_WarnPy3k into a macro
authorBenjamin Peterson <benjamin@python.org>
Mon, 26 May 2008 17:43:53 +0000 (17:43 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 26 May 2008 17:43:53 +0000 (17:43 +0000)
Include/warnings.h
Misc/NEWS
Python/_warnings.c

index e761adeb85a654b1a032b6dc2311eae511c2e452..79ef9f32e7d1620c2a2a393c36865478ca3dcd1c 100644 (file)
@@ -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)
index 3b5c2406c8fcc227ca942267972370923e206c4d..4f1c3c763b902e40935d5d99388654e3dcf69b3c 100644 (file)
--- 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?
index 9783745988d10c60cef45a450e4d947bb040d954..0adb0c8f96a5aac4bf6a1e3b5bd26ac4a29cf6df 100644 (file)
@@ -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.");