Ejemplo n.º 1
0
    def checktrace(self):
        from pypy.objspace import trace

        s = self.space

        # Did we modify __pytrace__
        tracelevel = s.int_w(s.getitem(self.w_globals, s.wrap("__pytrace__")))

        if self.tracelevel > 0 and tracelevel == 0:
            s.reset_trace()
            print "Tracing disabled"

        if self.tracelevel == 0 and tracelevel > 0:
            trace.create_trace_space(s)
            self.space.unsettrace()
            print "Tracing enabled"

        self.tracelevel = tracelevel
Ejemplo n.º 2
0
    def checktrace(self):
        from pypy.objspace import trace

        s = self.space

        # Did we modify __pytrace__
        tracelevel = s.int_w(s.getitem(self.w_globals, s.wrap("__pytrace__")))

        if self.tracelevel > 0 and tracelevel == 0:
            s.reset_trace()
            print "Tracing disabled"

        if self.tracelevel == 0 and tracelevel > 0:
            trace.create_trace_space(s)
            self.space.unsettrace()
            print "Tracing enabled"

        self.tracelevel = tracelevel
Ejemplo n.º 3
0
 def setup_method(self,method):
     trace.create_trace_space(self.space)
Ejemplo n.º 4
0
    from pypy.interpreter.gateway import app2interp
    from pypy.interpreter.argument import Arguments    

    # Create our function
    func_gw = app2interp(app_func)
    w_func = func_gw.get_function(tspace)

    # Run the func in the trace space and return results
    tspace.settrace()
    w_result = tspace.call_function(w_func, *args_w)
    trace_result = tspace.getresult()
    tspace.settrace()
    return w_result, trace_result

if __name__ == '__main__':

    from pypy.objspace import std, trace

    # Wrap up std space, with a trace space
    tspace = trace.create_trace_space(std.Space())

    def func(x):
        count = 0
        for ii in range(x):
            count += ii
        return count

    # Note includes lazy loading of builtins
    res = perform_trace(tspace, func, tspace.wrap(5))
    print "Result:", res
Ejemplo n.º 5
0
    from pypy.interpreter.argument import Arguments

    # Create our function
    func_gw = app2interp(app_func)
    w_func = func_gw.get_function(tspace)

    # Run the func in the trace space and return results
    tspace.settrace()
    w_result = tspace.call_function(w_func, *args_w)
    trace_result = tspace.getresult()
    tspace.settrace()
    return w_result, trace_result


if __name__ == '__main__':

    from pypy.objspace import std, trace

    # Wrap up std space, with a trace space
    tspace = trace.create_trace_space(std.Space())

    def func(x):
        count = 0
        for ii in range(x):
            count += ii
        return count

    # Note includes lazy loading of builtins
    res = perform_trace(tspace, func, tspace.wrap(5))
    print "Result:", res