[Python-Dev] PyErr_Warn or PyErr_WarnEx

Neal Norwitz nnorwitz at gmail.com
Wed Mar 19 05:13:22 CET 2008


On Tue, Mar 18, 2008 at 10:07 PM, Benjamin Peterson
<musiccomposition at gmail.com> wrote:
> Now that we're aggressively adding Py3k warnings to the trunk, I think it's
> a good time to get this straightened out. The docs [1] say PyErr_Warn is
> deprecated in favor of PyErr_WarnEx. However, I have seen both in recent
> checkins. What is preferred?

PyErr_WarnEx should be used.  PyErr_Warn is just (see from Include/pyerrors.h):

#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)

If someone wants to remove the macro in 3k, go for it.  There are many
of these compatibility macros and stub functions left around for
binary compatibility.  We should try to get rid of those in 3k and
shrink the API.

n


More information about the Python-Dev mailing list