Esempio n. 1
0
    def __init__(self):
        self.fromcache = InternalSpaceCache(self).getorbuild
        self.user_del_action = FakeUserDelAction(self)

        class dummy:
            pass

        self.config = dummy()
        self.config.translating = False

        # kill calls to c_call_i (i.e. slow path)
        def c_call_i(space, cppmethod, cppobject, nargs, args):
            assert not "slow path called"
            return capi.c_call_i(space, cppmethod, cppobject, nargs, args)

        executor.get_executor(
            self, 'int').__class__.c_stubcall = staticmethod(c_call_i)

        self.w_AttributeError = FakeException(self, "AttributeError")
        self.w_KeyError = FakeException(self, "KeyError")
        self.w_NotImplementedError = FakeException(self, "NotImplementedError")
        self.w_ReferenceError = FakeException(self, "ReferenceError")
        self.w_RuntimeError = FakeException(self, "RuntimeError")
        self.w_SystemError = FakeException(self, "SystemError")
        self.w_TypeError = FakeException(self, "TypeError")
        self.w_ValueError = FakeException(self, "ValueError")
Esempio n. 2
0
    def __init__(self):
        self.finalizer_queue = FakeFinalizerQueue()

        self.fromcache = InternalSpaceCache(self).getorbuild
        self.user_del_action = FakeUserDelAction(self)
        self.config = FakeConfig()
        self.config.translating = False

        # kill calls to c_call_i (i.e. slow path)
        def c_call_i(space, cppmethod, cppobject, nargs, args):
            assert not "slow path called"
            return capi.c_call_i(space, cppmethod, cppobject, nargs, args)

        executor.get_executor(
            self, 'int').__class__.c_stubcall = staticmethod(c_call_i)

        self.w_AttributeError = FakeException(self, "AttributeError")
        self.w_Exception = FakeException(self, "Exception")
        self.w_ImportError = FakeException(self, "ImportError")
        self.w_KeyError = FakeException(self, "KeyError")
        self.w_LookupError = FakeException(self, "LookupError")
        self.w_NotImplementedError = FakeException(self, "NotImplementedError")
        self.w_OSError = FakeException(self, "OSError")
        self.w_ReferenceError = FakeException(self, "ReferenceError")
        self.w_RuntimeError = FakeException(self, "RuntimeError")
        self.w_SystemError = FakeException(self, "SystemError")
        self.w_TypeError = FakeException(self, "TypeError")
        self.w_ValueError = FakeException(self, "ValueError")

        self.w_True = FakeBool(True)
        self.w_False = FakeBool(False)