Skip to content

Commit 9b97ab8

Browse files
committed
Fix logging handler management when reloading
The main module was removing the `_logging` module without invoking `plugin_unloaded`, which lead to the module being reloaded without the previous handler being cleaned up and causing duplicate logging events, especially when reloading the package with the AutomaticPackageReloader.
1 parent 2481199 commit 9b97ab8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import sys
22

33
# clear modules cache if package is reloaded (after update?)
4-
prefix = __package__ + "." # don't clear the base package
4+
prefix = __package__ + ".plugins" # don't clear the base package
55
for module_name in [
66
module_name
77
for module_name in sys.modules
8-
if module_name.startswith(prefix) and module_name != __name__
8+
if module_name.startswith(prefix)
99
]:
1010
del sys.modules[module_name]
11-
prefix = None
11+
del prefix
1212

1313
from .plugins import * # noqa

0 commit comments

Comments
 (0)