Example #1
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.wrap("version"),
                          space.wrap(version.get_version(space)))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)

        if not space.config.translating:
            # Install standard streams for tests that don't call app_main.
            # Always use line buffering, even for tests that capture
            # standard descriptors.
            space.appexec([], """():
                import sys, io
                sys.stdin = sys.__stdin__ = io.open(0, "r", encoding="ascii",
                                                    closefd=False)
                sys.stdin.buffer.raw.name = "<stdin>"
                sys.stdout = sys.__stdout__ = io.open(1, "w", encoding="ascii",
                                                      buffering=1,
                                                      closefd=False)
                sys.stdout.buffer.raw.name = "<stdout>"
                sys.stderr = sys.__stderr__ = io.open(2, "w", encoding="ascii",
                                                      errors="backslashreplace",
                                                      buffering=1,
                                                      closefd=False)
                sys.stderr.buffer.raw.name = "<stderr>"
               """)
Example #2
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)
Example #3
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)
Example #4
0
    def startup(self, space):
        if space.config.translating:
            assert self.filesystemencoding is None

        if not space.config.translating or we_are_translated():
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.newtext("version"),
                          version.get_version(space))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.newtext("dllhandle"), w_handle)

        from pypy.module.sys import system
        thread_info = system.get_thread_info(space)
        if thread_info is not None:
            space.setitem(self.w_dict, space.newtext('thread_info'), thread_info)