Skip to content

Commit 034d7bd

Browse files
rouaultgithub-actions[bot]
authored andcommitted
Python bindings: __init__.py: remove calls to warnings.simplefilter()
Fixes #11140 This changes the global warnings configuration, which is not appropriate to do inside a library.
1 parent 2287b5a commit 034d7bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

swig/python/osgeo/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ def ver_str(ver):
9393
if fail_on_unsupported_version:
9494
raise Exception(msg)
9595
else:
96-
from warnings import warn, simplefilter
97-
simplefilter('always', DeprecationWarning)
96+
from warnings import warn
9897
warn(msg, DeprecationWarning)
9998
elif this_python_version_will_be_deprecated_in_gdal_version:
10099
msg = 'You are using Python {} with GDAL {}. ' \
@@ -106,6 +105,5 @@ def ver_str(ver):
106105
ver_str(next_version_of_gdal_will_use_python_version),
107106
ver_str(this_python_version_will_be_deprecated_in_gdal_version))
108107

109-
from warnings import warn, simplefilter
110-
simplefilter('always', DeprecationWarning)
108+
from warnings import warn
111109
warn(msg, DeprecationWarning)

0 commit comments

Comments
 (0)