def cannotcompile(x): """Instruct Psyco never to compile the given function, method or code object.""" if isinstance(x, types.MethodType): x = x.im_func if isinstance(x, types.FunctionType): x = x.func_code if isinstance(x, types.CodeType): _psyco.cannotcompile(x) else: raise TypeError, "unexpected %s object" % type(x).__name__