engine.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Vanstein 作者: SunDwarf 项目源码 文件源码
def __run_natively(self, context: _VSContext, instruction: dis.Instruction):
        """
        Invokes a function natively.
        """
        # Get the number of arguments to pop off of the stack.
        number_of_args = instruction.arg
        args = []
        for x in range(0, number_of_args):
            # Pop each argument off of the stack.
            args.append(context.stack.pop())

        args = reversed(args)

        # Now pop the function, which is underneath all the others.
        fn = context.stack.pop()
        if not callable(fn):
            safe_raise(context, TypeError("'{}' object is not callable".format(fn)))
            return

        # Run the function.
        try:
            result = fn(*args)
        except BaseException as e:
            safe_raise(context, e)
            return

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号