def find_extension(self, name, path): from pypy.module.cpyext.modsupport import PyImport_AddModule from pypy.interpreter.module import Module try: w_dict = self.extensions[path] except KeyError: return None w_mod = PyImport_AddModule(self.space, name) assert isinstance(w_mod, Module) w_mdict = w_mod.getdict(self.space) self.space.call_method(w_mdict, 'update', w_dict) return w_mod