aur/stdlib-module-names.patch
Lars Beckers b0534f93d8 update to v0.3.3
Add compat patches for the ansible strategy plugin.
2022-08-02 22:49:19 +02:00

20 lines
583 B
Diff

diff --git a/mitogen/master.py b/mitogen/master.py
index 4fb535f0..e069902d 100644
--- a/mitogen/master.py
+++ b/mitogen/master.py
@@ -136,8 +136,14 @@ def is_stdlib_name(modname):
if module is None:
return False
+ try:
+ import importlib
+ return modname in importlib.sys.stdlib_module_names
+ except ImportError:
+ pass
+
# six installs crap with no __file__
- modpath = os.path.abspath(getattr(module, '__file__', ''))
+ modpath = os.path.abspath(getattr(module, '__file__', '') or '')
return is_stdlib_path(modpath)