Пример #1
0
from pypy.objspace.std.test.test_dictmultiobject import FakeSpace, W_DictMultiObject
from pypy.objspace.std.mapdict import *

class Config:
    class objspace:
        class std:
            withsmalldicts = False
            withcelldict = False
            withmethodcache = False
            withidentitydict = False
            withmapdict = True

space = FakeSpace()
space.config = Config

class Class(object):
    def __init__(self, hasdict=True):
        self.hasdict = True
        if hasdict:
            self.terminator = DictTerminator(space, self)
        else:
            self.terminator = NoDictTerminator(space, self)

    def instantiate(self, sp=None):
        if sp is None:
            sp = space
        result = Object()
        result.user_setup(sp, self)
        return result

class Object(Object):
Пример #2
0
from pypy.objspace.std.test.test_dictmultiobject import FakeSpace, W_DictObject
from pypy.objspace.std.mapdict import *


class Config:
    class objspace:
        class std:
            methodcachesizeexp = 11
            withmethodcachecounter = False


space = FakeSpace()
space.config = Config


class Class(object):
    def __init__(self, hasdict=True):
        self.hasdict = hasdict
        if hasdict:
            self.terminator = DictTerminator(space, self)
        else:
            self.terminator = NoDictTerminator(space, self)

    def instantiate(self, sp=None):
        if sp is None:
            sp = space
        if self.hasdict:
            result = Object()
        else:
            result = ObjectWithoutDict()
        result.user_setup(sp, self)