-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Do not call warnings.simplefilter
in library code
#11140
Comments
@idanmiara Any thought about that? I see you added that in 339a600 |
I frankly don't remember why I set |
thanks, will be fixed per #11141 |
1 task
rouault
added a commit
that referenced
this issue
Oct 28, 2024
Fixes #11140 This changes the global warnings configuration, which is not appropriate to do inside a library.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the bug?
In https://github.com/OSGeo/gdal/blob/master/swig/python/osgeo/__init__.py
warnings.simplefilter
is called to always display deprecation warnings. This changes the global warnings configuration, which is bad to do inside a library.In our case, this happened when using an older Python version and the newest GDAL that still supported it (which triggers a message saying that newer GDAL versions will drop support for that Python version). Due to the
warnings.simplefilter
change, a lot of deprecation warnings from other modules flooded our logs.We are going to patch our GDAL version suppressing calls to
warnings.simplefilter
. However, as this is still happening in master I wanted to open an issue for it to be fixed in the future.Steps to reproduce the issue
Just execute the newest GDAL which still has support for an older Python version.
Versions and provenance
GDAL 3.2.3 and Python 2.7 (but it will happen again when you drop support for another Python version).
Additional context
No response
The text was updated successfully, but these errors were encountered: