-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library does not respect warning filters #15
Comments
One possibility is to use the @deprecated(version='1.2.1', reason="deprecated function", action="ignore")
def fun():
print("fun") Does it fix your problem? |
That was a minimum working example. In actuality, we use the |
The documentation seems to suggest that the python warning control system is used, which should allow users to control warnings. Even the command line warning suppression doesn't work ( |
The current The problem with filters = [
(
'default',
None,
DeprecationWarning,
'__main__',
0,
),
(
'ignore',
None,
'<value is a self-reference, replaced by this string>',
None,
0,
),
(
'ignore',
None,
PendingDeprecationWarning,
None,
0,
),
(
'ignore',
None,
ImportWarning,
None,
0,
),
(
'ignore',
None,
ResourceWarning,
None,
0,
),
] So, the current implementation modify this global variable on every call: this is bad. A correct implementation of the
I'll see if this implementation is feasible… |
…f the *action* keyword argument is not provided or ``None``. In consequences, the warning messages are only emitted if the global filter allow it. For more information, see `The Warning Filter <https://docs.python.org/3/library/warnings.html#the-warnings-filter>`_ in the Python documentation.
…ilters with actions other than "ignore" and "always" on Python 3
…ilters with actions other than "ignore" and "always" on Python 3
… other than "ignore" and "always" on Python 3
Expected Behavior
When warning filters are applied, I'd expect the warnings to be suppressed.
Actual Behavior
The script emits a warning message:
Environment
The text was updated successfully, but these errors were encountered: