Skip to content

Commit

Permalink
Python bindings: __init__.py: remove calls to warnings.simplefilter()
Browse files Browse the repository at this point in the history
Fixes #11140

This changes the global warnings configuration, which is not appropriate
to do inside a library.
  • Loading branch information
rouault authored and github-actions[bot] committed Oct 28, 2024
1 parent 2287b5a commit 034d7bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions swig/python/osgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def ver_str(ver):
if fail_on_unsupported_version:
raise Exception(msg)
else:
from warnings import warn, simplefilter
simplefilter('always', DeprecationWarning)
from warnings import warn
warn(msg, DeprecationWarning)
elif this_python_version_will_be_deprecated_in_gdal_version:
msg = 'You are using Python {} with GDAL {}. ' \
Expand All @@ -106,6 +105,5 @@ def ver_str(ver):
ver_str(next_version_of_gdal_will_use_python_version),
ver_str(this_python_version_will_be_deprecated_in_gdal_version))

from warnings import warn, simplefilter
simplefilter('always', DeprecationWarning)
from warnings import warn
warn(msg, DeprecationWarning)

0 comments on commit 034d7bd

Please sign in to comment.