Jean-Paul Calderone <exar...@divmod.com> added the comment: Perhaps the C implementation should interpret the stacklevel parameter differently so that it is compatible with the Python implementation. The stacklevel value is, after all, a very important part of the interface of warnings.warn, as it is the only way to direct the warning at a piece of code.
If the C implementation doesn't add a frame to the stack, then maybe it should special case stacklevel=0 (eg, pointing somewhere arbitrary, not real, and obviously so). It seems that it already accounts for this fact for other stacklevel values, as it doesn't exhibit the obvious off-by-one error one might expect. Or, close this ticket as won't-fix, if there is no intention of ever fixing it. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4182> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com