Exemple #1
0
    def __init__(self, config=None):
        "NOT_RPYTHON: Basic initialization of objects."
        self.fromcache = InternalSpaceCache(self).getorbuild
        self.threadlocals = ThreadLocals()
        # set recursion limit
        # sets all the internal descriptors
        if config is None:
            from pypy.config.pypyoption import get_pypy_config
            config = get_pypy_config(translating=False)
        self.config = config

        # import extra modules for side-effects
        import pypy.interpreter.nestedscope  # register *_DEREF bytecodes

        self.interned_strings = {}
        self.actionflag = ActionFlag()  # changed by the signal module
        self.user_del_action = UserDelAction(self)
        self.frame_trace_action = FrameTraceAction(self)
        self.actionflag.register_action(self.user_del_action)
        self.actionflag.register_action(self.frame_trace_action)

        from pypy.interpreter.pyframe import PyFrame
        self.FrameClass = PyFrame  # can be overridden to a subclass

        if self.config.objspace.logbytecodes:
            self.bytecodecounts = [0] * 256
            self.bytecodetransitioncount = {}

        if self.config.objspace.timing:
            self.timer = Timer()
        else:
            self.timer = DummyTimer()

        self.initialize()