예제 #1
0
 def test_patch_os(self):
     import os
     from rpython.translator.oosupport.support import patch_os, unpatch_os, NT_OS
     original_O_CREAT = os.O_CREAT
     olddefs = patch_os()
     assert os.O_CREAT == NT_OS['O_CREAT']
     unpatch_os(olddefs)
     assert os.O_CREAT == original_O_CREAT
예제 #2
0
def compile_function(func, annotation=[], graph=None, backendopt=True,
                     auto_raise_exc=False, exctrans=False,
                     annotatorpolicy=None, nowrap=False):
    olddefs = patch_os()
    gen = _build_gen(func, annotation, graph, backendopt, exctrans, annotatorpolicy, nowrap)
    gen.generate_source()
    exe_name = gen.build_exe()
    unpatch_os(olddefs) # restore original values
    return CliFunctionWrapper(exe_name, func.__name__, auto_raise_exc)
예제 #3
0
파일: runtest.py 프로젝트: sota/pypy-old
 def compile(self, fn, args, ann=None, backendopt=False):
     if ann is None:
         ann = [lltype_to_annotation(typeOf(x)) for x in args]
     if self._func is fn and self._ann == ann:
         return JvmGeneratedSourceWrapper(self._jvm_src)
     else:
         self._func = fn
         self._ann = ann
         olddefs = patch_os()
         self._jvm_src = generate_source_for_function(fn, ann, backendopt)
         unpatch_os(olddefs)
         if not getoption('noasm'):
             self._jvm_src.compile()
         return JvmGeneratedSourceWrapper(self._jvm_src)
예제 #4
0
파일: runtest.py 프로젝트: sota/pypy
 def compile(self, fn, args, ann=None, backendopt=False):
     if ann is None:
         ann = [lltype_to_annotation(typeOf(x)) for x in args]
     if self._func is fn and self._ann == ann:
         return JvmGeneratedSourceWrapper(self._jvm_src)
     else:
         self._func = fn
         self._ann = ann
         olddefs = patch_os()
         self._jvm_src = generate_source_for_function(fn, ann, backendopt)
         unpatch_os(olddefs)
         if not getoption('noasm'):
             self._jvm_src.compile()
         return JvmGeneratedSourceWrapper(self._jvm_src)