func = importlib._bootstrap._handle_fromlist # "copy" the code to un-specialize it: func.__code__ = func.__code__.replace() assert not is_specialized(func), "specialized instructions found" for i in range(zĀ): func(importlib._bootstrap, ["x"], lambda *args: None) assert is_specialized(func), "no specialized instructions found" print("Tests passed") rĀ