Skip to main content

Python/

The heart of CPython. Contains the compiler chain (compile.c, codegen.c, flowgraph.c, assemble.c, symtable.c, ast.c), the eval loop (ceval.c, bytecodes.c, generated_cases.c.h), the specializer (specialize.c), the Tier-2 optimizer (optimizer.c), sys.monitoring (instrumentation.c), the GIL (ceval_gil.c), the GC (gc.c, gc_free_threading.c), and the import machinery (import.c).

File inventory

FileLinesPageSubsystem
Python/_contextvars.c68(pending)misc
Python/_warnings.c1691(pending)misc
Python/asdl.c6(pending)compile
Python/assemble.c802(pending)compile
Python/ast_preprocess.c990(pending)compile
Python/ast_unparse.c1029(pending)compile
Python/ast.c1091(pending)compile
Python/bltinmodule.c3497(pending)runtime
Python/bootstrap_hash.c598(pending)misc
Python/brc.c208(pending)gc-threading
Python/bytecodes.c5550bytecodeseval
Python/ceval_gil.c1434ceval-gileval
Python/ceval.c3725cevaleval
Python/codecs.c1708(pending)misc
Python/codegen.c6483codegencompile
Python/compile.c1753compilecompile
Python/context.c1359(pending)misc
Python/critical_section.c205(pending)gc-threading
Python/crossinterp.c3304(pending)misc
Python/dtoa.c2843(pending)misc
Python/dup2.c37(pending)misc
Python/dynamic_annotations.c154(pending)misc
Python/dynload_hpux.c76(pending)misc
Python/dynload_shlib.c113(pending)misc
Python/dynload_stub.c9(pending)misc
Python/dynload_win.c329(pending)misc
Python/emscripten_signal.c54(pending)misc
Python/emscripten_syscalls.c319(pending)misc
Python/emscripten_trampoline_inner.c38(pending)misc
Python/emscripten_trampoline.c118(pending)misc
Python/errors.c2069errorsruntime
Python/fileutils.c3112(pending)runtime
Python/flowgraph.c4165flowgraphcompile
Python/formatter_unicode.c1726(pending)runtime
Python/frame.c159(pending)eval
Python/frozen.c132(pending)runtime
Python/frozenmain.c99(pending)runtime
Python/future.c119(pending)compile
Python/gc_free_threading.c3006(pending)gc-threading
Python/gc_gil.c17(pending)gc-threading
Python/gc.c2057gcgc-threading
Python/getargs.c2863(pending)runtime
Python/getcompiler.c27(pending)runtime
Python/getcopyright.c23(pending)runtime
Python/getopt.c163(pending)runtime
Python/getplatform.c12(pending)runtime
Python/getversion.c34(pending)runtime
Python/hamt.c2885(pending)misc
Python/hashtable.c424(pending)misc
Python/import.c4956importruntime
Python/importdl.c520(pending)runtime
Python/index_pool.c197(pending)gc-threading
Python/initconfig.c4751(pending)runtime
Python/instruction_sequence.c483(pending)compile
Python/instrumentation.c3174(pending)eval
Python/interpconfig.c269(pending)runtime
Python/intrinsics.c287(pending)eval
Python/jit.c523(pending)eval
Python/legacy_tracing.c781(pending)eval
Python/lock.c638(pending)gc-threading
Python/marshal.c2163(pending)compile
Python/modsupport.c673(pending)runtime
Python/mysnprintf.c80(pending)misc
Python/mystrtoul.c297(pending)misc
Python/object_stack.c66(pending)gc-threading
Python/optimizer_analysis.c656(pending)eval
Python/optimizer_bytecodes.c1107(pending)eval
Python/optimizer_symbols.c880(pending)eval
Python/optimizer.c1755optimizereval
Python/parking_lot.c442(pending)gc-threading
Python/pathconfig.c471(pending)runtime
Python/perf_jit_trampoline.c1363(pending)misc
Python/perf_trampoline.c634(pending)misc
Python/preconfig.c978(pending)runtime
Python/pyarena.c207(pending)misc
Python/pyctype.c214(pending)misc
Python/pyfpe.c18(pending)misc
Python/pyhash.c498(pending)misc
Python/pylifecycle.c3630pylifecycleruntime
Python/pymath.c19(pending)misc
Python/pystate.c3261(pending)misc
Python/pystrcmp.c30(pending)misc
Python/pystrhex.c171(pending)misc
Python/pystrtod.c1286(pending)misc
Python/Python-ast.c18485(pending)compile
Python/Python-tokenize.c445(pending)misc
Python/pythonrun.c1737pythonrunruntime
Python/pytime.c1356(pending)misc
Python/qsbr.c290(pending)gc-threading
Python/remote_debugging.c401(pending)misc
Python/specialize.c3232specializeeval
Python/stackrefs.c219(pending)eval
Python/structmember.c382(pending)runtime
Python/suggestions.c206(pending)runtime
Python/symtable.c3266symtablecompile
Python/sysmodule.c4522sysmoduleruntime
Python/thread.c301(pending)gc-threading
Python/traceback.c1473(pending)runtime
Python/tracemalloc.c1489(pending)misc
Python/uniqueid.c232(pending)gc-threading
Python/ceval_macros.h439(pending)eval
Python/condvar.h315(pending)gc-threading
Python/config_common.h36(pending)misc
Python/crossinterp_data_lookup.h835(pending)misc
Python/crossinterp_exceptions.h199(pending)misc
Python/executor_cases.c.h7164(pending)eval
Python/generated_cases.c.h12528(pending)eval
Python/opcode_targets.h766(pending)eval
Python/optimizer_cases.c.h2520(pending)eval
Python/remote_debug.h1190(pending)misc
Python/stdlib_module_names.h302(pending)misc
Python/thread_nt.h532(pending)gc-threading
Python/thread_pthread_stubs.h191(pending)gc-threading
Python/thread_pthread.h1002(pending)gc-threading

Subsystem legend: compile (AST through bytecode), eval (the interpreter and its optimizers), runtime (errors, imports, configuration), gc-threading (memory and concurrency), misc (arena, hashing, string conversion, perf, host glue).

Total: 114 files, ~166k lines. The two largest files (Python-ast.c 18k, generated_cases.c.h 12k) are generated; the generator pages are the canonical reading. See Tools/cases_generator/ and Parser/asdl_c.py.