MCPcopy Index your code
hub / github.com/python/cpython / _compile_one_py

Function _compile_one_py

PC/layout/main.py:323–348  ·  view source on GitHub ↗
(src, dest, name, optimize, checked=True)

Source from the content-addressed store, hash-verified

321
322
323def _compile_one_py(src, dest, name, optimize, checked=True):
324 import py_compile
325
326 if dest is not None:
327 dest = str(dest)
328
329 mode = (
330 py_compile.PycInvalidationMode.CHECKED_HASH
331 if checked
332 else py_compile.PycInvalidationMode.UNCHECKED_HASH
333 )
334
335 try:
336 return Path(
337 py_compile.compile(
338 str(src),
339 dest,
340 str(name),
341 doraise=True,
342 optimize=optimize,
343 invalidation_mode=mode,
344 )
345 )
346 except py_compile.PyCompileError:
347 log_warning("Failed to compile {}", src)
348 return None
349
350
351# name argument added to address bpo-37641

Callers 2

_py_temp_compileFunction · 0.85
copy_filesFunction · 0.85

Calls 4

PathClass · 0.90
strFunction · 0.85
log_warningFunction · 0.85
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…