New submission from Xavier Morel <[email protected]>:
Warning actions allow deduplicating warning triggers based on category
("once"), category + file ("module") and category + exact location ("default").
One thing which is missing is support for a single location generating warnings
*on behalf* of other pieces of code.
`warnings.warn` provides some support via the "stacklevel" parameter, but it is
difficult to compute if the warning is generated from somewhat nested generic
code (or even impossible if the warning is generated from completely generic
code checking over e.g. data files or the like, or if the invoker could be
invoked from multiple places with different depth difference from the code
they're working for).
But in that case, the warning messages will often be unique per functional
unit, so it could be a useful base for deduplication, even though the warning
could dynamically be invoked multiple times (per functional unit) because e.g.
code is reloaded or whatever.
----------
components: Library (Lib)
messages: 375924
nosy: xmorel
priority: normal
severity: normal
status: open
title: Add a "message" action to warnings, to trigger for every *unique* message
type: enhancement
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41641>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com