Clear the __warningregistry__ for all modules.
()
| 243 | |
| 244 | # Helper method to workaround https://bugs.python.org/issue21724 |
| 245 | def clear_warning_registry(): |
| 246 | """Clear the __warningregistry__ for all modules.""" |
| 247 | for _, module in list(sys.modules.items()): |
| 248 | if hasattr(module, "__warningregistry__"): |
| 249 | module.__warningregistry__ = {} # type:ignore[attr-defined] |
| 250 | |
| 251 | |
| 252 | class SystemCertsPatcher: |