]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix order of warnings filters 7062/head
authorrallyemax <coloradan@gmail.com>
Tue, 21 Sep 2021 22:27:41 +0000 (16:27 -0600)
committerGitHub <noreply@github.com>
Tue, 21 Sep 2021 22:27:41 +0000 (16:27 -0600)
commitcf3f76f817df1a500be1a6cc7a3a4b38be507861
tree302be30b8e2f297e4caee7b2fee72ec391c79440
parenta7e787a331dd9e5c172a5650397e4e9528ac3632
Fix order of warnings filters

The `warnings.filterwarnings` method inserts entries at the front of the filter list, and entries closer to the front of the list override entries later in the list, if both match a particular warning. (See https://docs.python.org/3/library/warnings.html)

The intended behavior is for all `RemovedIn20Warning` warnings to log and continue, except that specific warnings that match the defined regular expressions should be raised as exceptions. To accomplish this intent, the general filter must be inserted before the regular expression special cases.

The original order would work if `warnings.filterwarnings` for the default case were invoked with `append=True`, but the intent of the documentation is for this set of filters to be determinative (i.e. to override any conflicting pre-existing filters that may exist), so `append=True` should not be used.
doc/build/changelog/migration_20.rst