diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 06:55:48 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 06:55:48 (GMT) |
commit | 07aadb14f39c585a463f19ec0496860a100051ad (patch) | |
tree | 633fcc0bb9fa8edbdae49bf761c3c3ec822319c6 /Include | |
parent | 0d62a062066a4cbc8aabab9c305d60ebf7922c8c (diff) | |
download | cpython-07aadb14f39c585a463f19ec0496860a100051ad.zip cpython-07aadb14f39c585a463f19ec0496860a100051ad.tar.gz cpython-07aadb14f39c585a463f19ec0496860a100051ad.tar.bz2 |
Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
This provides the proper warning for struct.pack().
PyErr_Warn() is now deprecated in favor of PyErr_WarnEx().
As mentioned by Tim Peters on python-dev.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pyerrors.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 6fa6ed7..ae1d990 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -225,10 +225,14 @@ PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base, PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* Issue a warning or exception */ -PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *); +PyAPI_FUNC(int) PyErr_WarnEx(PyObject *category, const char *msg, + Py_ssize_t stack_level); 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); |