Example #1
0
        source = charp2str(source)
        w_dict = space.newdict()
        try:
            ec = space.getexecutioncontext()
            pycode = ec.compiler.compile(source, 'source', 'exec', 0)
            pycode.exec_code(space, w_dict, w_dict)
        except OperationError, e:
            print "OperationError:"
            print " operror-type: " + e.w_type.getname(space)
            print " operror-value: " + space.str_w(
                space.str(e.get_w_value(space)))
            return 1
        return 0

    dll = DLLDef('pypylib', [(interpret, [CCHARP, VOIDP])],
                 policy=policy,
                 config=config)
    exe_name = dll.compile()


if __name__ == '__main__':
    try:
        main(sys.argv)
    except KeyboardInterrupt:
        raise
    except:
        e, v, tb = sys.exc_info()
        traceback.print_tb(tb)
        print e, v
        pdb.post_mortem(tb)