1# test overriding __import__ combined with importing from the filesystem 2 3 4def custom_import(name, globals, locals, fromlist, level): 5 print("import", name, fromlist, level) 6 7 class M: 8 var = 456 9 10 return M 11 12 13orig_import = __import__ 14try: 15 __import__("builtins").__import__ = custom_import 16except AttributeError: 17 print("SKIP") 18 raise SystemExit 19 20# import1a will be done via normal import which will import1b via our custom import 21orig_import("import1a") 22