Why let the bytecode out of the bag >:(

This commit is contained in:
Gnarwhal 2024-09-14 17:59:06 +00:00
parent 1a9001e956
commit ffa0637b29
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174

View file

@ -185,10 +185,12 @@ class Plugin:
@staticmethod
def external(path, logger=None, config=dict(), flags=dict()):
sys.dont_write_bytecode = True
module_spec = importlib.util.spec_from_file_location(
path.stem,
path.as_posix(),
)
module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(module)
sys.dont_write_bytecode = False
return Plugin(path.stem, module, logger, config.get(path.stem, dict()), flags.get(path.stem, dict()))