示例#1
0
 def __init__(self, space, w_name):
     backend = space.config.translation.backend
     # the Win32 urandom implementation isn't going to translate on JVM or CLI
     # so we have to remove it
     if 'urandom' in self.interpleveldefs and (backend == 'cli' or backend == 'jvm'):
         del self.interpleveldefs['urandom']
     MixedModule.__init__(self, space, w_name)
示例#2
0
 def __init__(self, space, *args):
     "NOT_RPYTHON: patches space.threadlocals to use real threadlocals"
     from pypy.module.thread import gil
     MixedModule.__init__(self, space, *args)
     prev = space.threadlocals.getvalue()
     space.threadlocals = gil.GILThreadLocals()
     space.threadlocals.setvalue(prev)
示例#3
0
            def __init__(self, space, w_name):
                def loader(myspace):
                    assert myspace is space
                    return myspace.wrap("hello")

                MixedModule.__init__(self, space, w_name)
                self.loaders["hi"] = loader
示例#4
0
    def __init__(self, space, w_name):
        def create_lambda(name, alsoname):
            return lambda space: self.getdictvalue(space, alsoname)

        MixedModule.__init__(self, space, w_name)
        for name, alsoname in self.mapping.iteritems():
            self.loaders[name] = create_lambda(name, alsoname)
示例#5
0
 def __init__(self, space, w_name):
     def create_lambda(name, alsoname):
         return lambda space : self.getdictvalue(space, space.wrap(alsoname))
     
     MixedModule.__init__(self, space, w_name)
     for name, alsoname in self.mapping.iteritems():
         self.loaders[name] = create_lambda(name, alsoname)
示例#6
0
文件: __init__.py 项目: chyyuu/pygirl
 def __init__(self, space, *args):
     "NOT_RPYTHON: patches space.threadlocals to use real threadlocals"
     from pypy.module.thread import gil
     MixedModule.__init__(self, space, *args)
     prev = space.threadlocals.getvalue()
     space.threadlocals = gil.GILThreadLocals()
     space.threadlocals.setvalue(prev)
            def __init__(self, space, w_name):
                def loader(myspace):
                    assert myspace is space
                    return myspace.wrap("hello")

                MixedModule.__init__(self, space, w_name)
                self.loaders["hi"] = loader
示例#8
0
    def __init__(self, space, *args):
        "NOT_RPYTHON"
        MixedModule.__init__(self, space, *args)

        # pythonization functions may be written in RPython, but the interp2app
        # code generation is not, so give it a chance to run now
        from pypy.module.cppyy import capi
        capi.register_pythonizations(space)
示例#9
0
 def __init__(self, space, w_name):
     # if it's an ootype translation, remove all the defs that are lltype
     # only
     backend = space.config.translation.backend
     if backend == 'cli' or backend == 'jvm':
         for name in lltype_only_defs:
             self.interpleveldefs.pop(name, None)
     MixedModule.__init__(self, space, w_name)
示例#10
0
 def __init__(self, space, w_name):
     # if it's an ootype translation, remove all the defs that are lltype
     # only
     backend = space.config.translation.backend
     if backend == "cli" or backend == "jvm":
         for name in lltype_only_defs:
             self.interpleveldefs.pop(name, None)
     MixedModule.__init__(self, space, w_name)
示例#11
0
文件: __init__.py 项目: Darriall/pypy
    def __init__(self, space, *args):
        "NOT_RPYTHON"
        MixedModule.__init__(self, space, *args)

        # pythonization functions may be written in RPython, but the interp2app
        # code generation is not, so give it a chance to run now
        from pypy.module.cppyy import capi
        capi.register_pythonizations(space)
示例#12
0
文件: __init__.py 项目: Qointum/pypy
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     MixedModule.__init__(self, space, *args)
     from pypy.module.posix.interp_posix import add_fork_hook
     from pypy.module.imp import interp_imp
     add_fork_hook('before', interp_imp.acquire_lock)
     add_fork_hook('parent', interp_imp.release_lock)
     add_fork_hook('child', interp_imp.reinit_lock)
示例#13
0
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     MixedModule.__init__(self, space, *args)
     from pypy.module.posix.interp_posix import add_fork_hook
     from pypy.module.imp import interp_imp
     add_fork_hook('before', interp_imp.acquire_lock)
     add_fork_hook('parent', interp_imp.release_lock)
     add_fork_hook('child', interp_imp.reinit_lock)
示例#14
0
 def __init__(self, space, *args):
     MixedModule.__init__(self, space, *args)
     #
     if not space.config.objspace.disable_entrypoints:
         # import 'embedding', which has the side-effect of registering
         # the 'pypy_init_embedded_cffi_module' entry point
         from pypy.module._cffi_backend import embedding
         embedding.glob.space = space
示例#15
0
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     from pypy.module.signal import interp_signal
     MixedModule.__init__(self, space, *args)
     # add the signal-checking callback as an action on the space
     space.check_signal_action = interp_signal.CheckSignalAction(space)
     space.actionflag.register_periodic_action(space.check_signal_action,
                                               use_bytecode_counter=False)
     space.actionflag.__class__ = interp_signal.SignalActionFlag
示例#16
0
    def __init__(self, space, *args):
        # mbcs codec is Windows specific, and based on rffi.
        if (hasattr(runicode, 'str_decode_mbcs')):
            self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
            self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'

        MixedModule.__init__(self, space, *args)

        interp_codecs.register_builtin_error_handlers(space)
示例#17
0
文件: __init__.py 项目: njues/Sypy
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     from pypy.module.signal import interp_signal
     MixedModule.__init__(self, space, *args)
     # add the signal-checking callback as an action on the space
     space.check_signal_action = interp_signal.CheckSignalAction(space)
     space.actionflag.register_periodic_action(space.check_signal_action,
                                               use_bytecode_counter=False)
     space.actionflag.__class__ = interp_signal.SignalActionFlag
示例#18
0
 def __init__(self, space, *args):
     "NOT_RPYTHON: patches space.threadlocals to use real threadlocals"
     from pypy.module.thread import gil
     MixedModule.__init__(self, space, *args)
     prev = space.threadlocals.getvalue()
     space.threadlocals = gil.GILThreadLocals()
     space.threadlocals.setvalue(prev)
     space.threadlocals.enter_thread(space)   # setup the main thread
     # add the GIL-releasing callback as an action on the space
     space.pending_actions.append(gil.GILReleaseAction(space.threadlocals))
示例#19
0
    def __init__(self, space, *args):
        "NOT_RPYTHON"

        # mbcs codec is Windows specific, and based on rffi.
        if (hasattr(runicode, 'str_decode_mbcs')
                and space.config.translation.type_system != 'ootype'):
            self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
            self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'

        MixedModule.__init__(self, space, *args)
示例#20
0
文件: __init__.py 项目: alkorzt/pypy
    def __init__(self, space, *args):
        "NOT_RPYTHON"

        # mbcs codec is Windows specific, and based on rffi.
        if (hasattr(runicode, 'str_decode_mbcs') and
            space.config.translation.type_system != 'ootype'):
            self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
            self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'

        MixedModule.__init__(self, space, *args)
示例#21
0
文件: __init__.py 项目: charred/pypy
    def __init__(self, space, *args):
        "NOT_RPYTHON"

        # mbcs codec is Windows specific, and based on rffi.
        if (hasattr(runicode, 'str_decode_mbcs')):
            self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
            self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'

        MixedModule.__init__(self, space, *args)

        interp_codecs.register_builtin_error_handlers(space)
示例#22
0
    def __init__(self, space, *args):
        "NOT_RPYTHON"

        # on windows with oo backends, remove file.truncate,
        # because the implementation is based on rffi
        if (sys.platform == 'win32'
                and space.config.translation.type_system == 'ootype'):
            from pypy.module._file.interp_file import W_File
            del W_File.typedef.rawdict['truncate']

        MixedModule.__init__(self, space, *args)
示例#23
0
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     from pypy.module.signal import interp_signal
     MixedModule.__init__(self, space, *args)
     # add the signal-checking callback as an action on the space
     space.check_signal_action = interp_signal.CheckSignalAction(space)
     space.actionflag.register_action(space.check_signal_action)
     # use the C-level pypysig_occurred variable as the action flag
     # (the result is that the C-level signal handler will directly
     # set the flag for the CheckSignalAction)
     space.actionflag.__class__ = interp_signal.SignalActionFlag
示例#24
0
文件: __init__.py 项目: alkorzt/pypy
    def __init__(self, space, *args):
        "NOT_RPYTHON"

        # on windows with oo backends, remove file.truncate,
        # because the implementation is based on rffi
        if (sys.platform == 'win32' and
            space.config.translation.type_system == 'ootype'):
            from pypy.module._file.interp_file import W_File
            del W_File.typedef.rawdict['truncate']

        MixedModule.__init__(self, space, *args)
示例#25
0
    def __init__(self, space, *args):
        "NOT_RPYTHON: patches space.threadlocals to use real threadlocals"
        from pypy.module.thread import gil
        MixedModule.__init__(self, space, *args)
        prev = space.threadlocals.getvalue()
        space.threadlocals = gil.GILThreadLocals()
        space.threadlocals.initialize(space)
        space.threadlocals.setvalue(prev)

        from pypy.module.posix.interp_posix import add_fork_hook
        from pypy.module.thread.os_thread import reinit_threads
        add_fork_hook('child', reinit_threads)
示例#26
0
    def __init__(self, space, *args):
        "NOT_RPYTHON: patches space.threadlocals to use real threadlocals"
        from pypy.module.thread import gil
        MixedModule.__init__(self, space, *args)
        prev = space.threadlocals.getvalue()
        space.threadlocals = gil.GILThreadLocals()
        space.threadlocals.initialize(space)
        space.threadlocals.setvalue(prev)

        from pypy.module.posix.interp_posix import add_fork_hook
        from pypy.module.thread.os_thread import reinit_threads
        add_fork_hook('child', reinit_threads)
示例#27
0
    def __init__(self, space, *args):
        # mbcs codec is Windows specific, and based on rffi system calls.
        if rwin32.WIN32:
            self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
            self.interpleveldefs['oem_encode'] = 'interp_codecs.oem_encode'
            self.interpleveldefs['code_page_encode'] = 'interp_codecs.code_page_encode'
            self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'
            self.interpleveldefs['oem_decode'] = 'interp_codecs.oem_decode'
            self.interpleveldefs['code_page_decode'] = 'interp_codecs.code_page_decode'

        MixedModule.__init__(self, space, *args)

        interp_codecs.register_builtin_error_handlers(space)
示例#28
0
 def __init__(self, space, w_name):
     if (not space.config.translating or
         space.config.translation.gctransformer == "framework"):
         self.appleveldefs.update({
             'dump_rpy_heap': 'app_referents.dump_rpy_heap',
             })
         self.interpleveldefs.update({
             'get_rpy_roots': 'referents.get_rpy_roots',
             'get_rpy_referents': 'referents.get_rpy_referents',
             'get_rpy_memory_usage': 'referents.get_rpy_memory_usage',
             'get_rpy_type_index': 'referents.get_rpy_type_index',
             'get_objects': 'referents.get_objects',
             'get_referents': 'referents.get_referents',
             'get_referrers': 'referents.get_referrers',
             '_dump_rpy_heap': 'referents._dump_rpy_heap',
             'get_typeids_z': 'referents.get_typeids_z',
             'GcRef': 'referents.W_GcRef',
             })
     MixedModule.__init__(self, space, w_name)
示例#29
0
 def __init__(self, space, w_name):
     if (not space.config.translating or
         space.config.translation.gctransformer == "framework"):
         self.appleveldefs.update({
             'dump_rpy_heap': 'app_referents.dump_rpy_heap',
             })
         self.interpleveldefs.update({
             'get_rpy_roots': 'referents.get_rpy_roots',
             'get_rpy_referents': 'referents.get_rpy_referents',
             'get_rpy_memory_usage': 'referents.get_rpy_memory_usage',
             'get_rpy_type_index': 'referents.get_rpy_type_index',
             'get_objects': 'referents.get_objects',
             'get_referents': 'referents.get_referents',
             'get_referrers': 'referents.get_referrers',
             '_dump_rpy_heap': 'referents._dump_rpy_heap',
             'get_typeids_z': 'referents.get_typeids_z',
             'GcRef': 'referents.W_GcRef',
             })
     MixedModule.__init__(self, space, w_name)
示例#30
0
文件: __init__.py 项目: zcxowwww/pypy
 def __init__(self, space, w_name):
     if (not space.config.translating
             or space.config.translation.gctransformer == "framework"):
         self.appleveldefs.update({
             'dump_rpy_heap': 'app_referents.dump_rpy_heap',
             'get_stats': 'app_referents.get_stats',
         })
         self.interpleveldefs.update({
             'collect_step':
             'interp_gc.collect_step',
             'get_rpy_roots':
             'referents.get_rpy_roots',
             'get_rpy_referents':
             'referents.get_rpy_referents',
             'get_rpy_memory_usage':
             'referents.get_rpy_memory_usage',
             'get_rpy_type_index':
             'referents.get_rpy_type_index',
             'get_objects':
             'referents.get_objects',
             'get_referents':
             'referents.get_referents',
             'get_referrers':
             'referents.get_referrers',
             '_get_stats':
             'referents.get_stats',
             '_dump_rpy_heap':
             'referents._dump_rpy_heap',
             'get_typeids_z':
             'referents.get_typeids_z',
             'get_typeids_list':
             'referents.get_typeids_list',
             'GcRef':
             'referents.W_GcRef',
             'hooks':
             'space.fromcache(hook.W_AppLevelHooks)',
             'GcCollectStepStats':
             'hook.W_GcCollectStepStats',
         })
     MixedModule.__init__(self, space, w_name)
示例#31
0
 def __init__(self, space, w_name):
     ts = space.config.translation.type_system
     if ts == 'ootype':
         del self.interpleveldefs['dump_heap_stats']
     MixedModule.__init__(self, space, w_name)
示例#32
0
文件: __init__.py 项目: alkorzt/pypy
 def __init__(self, space, w_name):
     ts = space.config.translation.type_system
     if ts == 'ootype':
         del self.interpleveldefs['dump_heap_stats']
     MixedModule.__init__(self, space, w_name)
示例#33
0
 def __init__(self, space, *args):
     "NOT_RPYTHON"
     from pypy.module.signal.interp_signal import CheckSignalAction
     MixedModule.__init__(self, space, *args)
     # add the signal-checking callback as an action on the space
     space.pending_actions.append(CheckSignalAction(space))
示例#34
0
 def __init__(self, space, w_name):
     MixedModule.__init__(self, space, w_name)
     _init_symbols(space.config.objspace.pyversion)