A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-May/065478.html below:

[Python-Dev] Add new PyErr_WarnEx() to 2.5?

[Python-Dev] Add new PyErr_WarnEx() to 2.5? [Python-Dev] Add new PyErr_WarnEx() to 2.5?Tim Peters tim.peters at gmail.com
Wed May 31 16:42:43 CEST 2006
[Ronald Oussoren, hijacking the "test_struct failure on 64 bit platforms"
 thread]
> The really annoying part of the new struct warnings is that the
> warning line mentions a line in struct.py instead the caller of
> struct.pack. That makes it hard to find the source of the
> warning without telling the warnings module to raise an
> exception for DeprecationWarnings.

The problem seems to be that Python's C API apparently gives no simple
way to supply a value for warning.warn's optional `stacklevel`
argument.  The C-level signature is:

    int PyErr_Warn(PyObject *category, char *message);

and that's what _struct.c calls.  I think it would be good to add a new

    int PyErr_WarnEx(PyObject *category, char *message, long stacklevel);

C API function, change PyErr_Warn to call that forcing stacklevel to
1, and change _struct.c to call PyErr_WarnEx with stacklevel=2.  Then
it would point at struct.pack()'s caller.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4