Every line of 'how to compile python to pyc' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
88 def compile_missing_pyc(): 89 sp_dir = environ.sp_dir 90 91 need_compile = False 92 for root, dirs, files in os.walk(sp_dir): 93 for fn in files: 94 if fn.endswith('.py') and fn + 'c' not in files: 95 need_compile = True 96 if need_compile: 97 print('compiling .pyc files...') 98 check_call([build_python, '-Wi', join(environ.stdlib_dir, 99 'compileall.py'), 100 '-q', '-x', 'port_v3', sp_dir])
51 def _exec_code(self, code): 52 if code: 53 code = compile(code, str(self.filename), 'exec', dont_inherit=True) 54 exec(code, vars(self.namespace))
125 def test_compile_unicode(self): 126 co = py.code.compile(unicode('u"\xc3\xa5"', 'utf8'), mode='eval') 127 val = eval(co) 128 assert isinstance(val, unicode)