Debian Codegraph @

pypy/module/_jitlog/interp_jitlog.py

raw symbols SCIP
1 from pypy.interpreter.error import OperationError
2 from pypy.interpreter.gateway import unwrap_spec
3 from pypy.interpreter.pyframe import PyFrame
4 from pypy.interpreter.pycode import PyCode
5 from pypy.interpreter.baseobjspace import W_Root
6 from rpython.rlib.rjitlog import rjitlog
7 from rpython.rlib import jit
8
9 class Cache:
10 def __init__(self, space):
11 self.w_JitlogError = space.new_exception_class("_jitlog.JitlogError")
12
13 def JitlogError(space, e):
14 w_JitlogError = space.fromcache(Cache).w_JitlogError
15 return OperationError(w_JitlogError, space.newtext(e.msg))
16
17 @unwrap_spec(fileno=int)
18 def enable(space, fileno):
19 """ Enable PyPy's logging facility. """
20 try:
21 rjitlog.enable_jitlog(fileno)
22 except rjitlog.JitlogError, e:
23 raise JitlogError(space, e)
24
25 @jit.dont_look_inside
26 def disable(space):
27 """ Disable PyPy's logging facility. """
28 rjitlog.disable_jitlog()