Skip to content

Commit

Permalink
Add warning filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Sep 4, 2024
1 parent 24698e7 commit daaf04b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sage_docbuild/sphinxbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ def runsphinx():
saved_stdout = sys.stdout
saved_stderr = sys.stderr

if not sys.warnoptions:
import warnings
original_filters = warnings.filters[:]
warnings.filterwarnings("ignore", category=DeprecationWarning, module='sphinx.util.inspect')

try:
sys.stdout = SageSphinxLogger(sys.stdout, os.path.basename(output_dir))
sys.stderr = SageSphinxLogger(sys.stderr, os.path.basename(output_dir))
Expand All @@ -323,3 +328,6 @@ def runsphinx():
sys.stderr = saved_stderr
sys.stdout.flush()
sys.stderr.flush()

if not sys.warnoptions:
warnings.filters = original_filters[:]

0 comments on commit daaf04b

Please sign in to comment.