Unverified Commit f73c7a64 authored by Tong He's avatar Tong He Committed by GitHub
Browse files

[bugfix] Set `stacklevel=2` for `dgl_warning` (#3816)


Co-authored-by: default avatarJinjing Zhou <VoVAllen@users.noreply.github.com>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent 7d416086
...@@ -40,9 +40,9 @@ def dgl_warning_format(message, category, filename, lineno, line=None): ...@@ -40,9 +40,9 @@ def dgl_warning_format(message, category, filename, lineno, line=None):
else: else:
return _default_formatwarning(message, category, filename, lineno, line=None) return _default_formatwarning(message, category, filename, lineno, line=None)
def dgl_warning(message, category=DGLWarning, stacklevel=1): def dgl_warning(message, category=DGLWarning, stacklevel=2):
"""DGL warning wrapper that defaults to ``DGLWarning`` instead of ``UserWarning`` category.""" """DGL warning wrapper that defaults to ``DGLWarning`` instead of ``UserWarning`` category."""
return warnings.warn(message, category=category, stacklevel=1) return warnings.warn(message, category=category, stacklevel=stacklevel)
warnings.formatwarning = dgl_warning_format warnings.formatwarning = dgl_warning_format
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment