[Python-checkins] r62517 - in python/trunk: Doc/c-api/exceptions.rst Include/warnings.h Misc/NEWS Python/_warnings.c
benjamin.peterson
python-checkins at python.org
Sun Apr 27 04:28:03 CEST 2008
Author: benjamin.peterson
Date: Sun Apr 27 04:28:02 2008
New Revision: 62517
Log:
Added PyErr_WarnPy3k function. (issue 2671) I will be converting current Py3k warnings to the use of this function soon.
Modified:
python/trunk/Doc/c-api/exceptions.rst
python/trunk/Include/warnings.h
python/trunk/Misc/NEWS
python/trunk/Python/_warnings.c
Modified: python/trunk/Doc/c-api/exceptions.rst
==============================================================================
--- python/trunk/Doc/c-api/exceptions.rst (original)
+++ python/trunk/Doc/c-api/exceptions.rst Sun Apr 27 04:28:02 2008
@@ -344,6 +344,14 @@
described there.
+.. cfunction:: int PyErr_WarnPy3k(char *message, int stacklevel)
+
+ Issue a :exc:`DeprecationWarning` with the given *message* and *stacklevel*
+ if the :cdata:`Py_Py3kWarningFlag` flag is enabled.
+
+ .. versionadded:: 2.6
+
+
.. cfunction:: int PyErr_CheckSignals()
.. index::
Modified: python/trunk/Include/warnings.h
==============================================================================
--- python/trunk/Include/warnings.h (original)
+++ python/trunk/Include/warnings.h Sun Apr 27 04:28:02 2008
@@ -9,6 +9,7 @@
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);
/* DEPRECATED: Use PyErr_WarnEx() instead. */
#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Apr 27 04:28:02 2008
@@ -143,6 +143,9 @@
platforms 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.
+
What's New in Python 2.6 alpha 2?
=================================
Modified: python/trunk/Python/_warnings.c
==============================================================================
--- python/trunk/Python/_warnings.c (original)
+++ python/trunk/Python/_warnings.c Sun Apr 27 04:28:02 2008
@@ -732,6 +732,15 @@
}
+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.");
More information about the Python-checkins
mailing list