CPython
termKept in this browser · My desk
The canonical implementation of Python, written in C and distributed on python.org, where new language features generally appear first.
It compiles source code to bytecode, cached in .pyc files and not stable between releases, and runs that bytecode on its virtual machine. Its global interpreter lock lets only one thread run Python bytecode at a time but is always released during input and output (I/O), so threads still help a script that waits on sockets. Python 3.13 added an experimental build without the lock, and 3.14 made that free-threaded build officially supported but optional. The language reference also names PyPy, Jython and IronPython as other implementations.
Python is a language described by a reference manual, and CPython is the program that most people mean when they say they ran it. The documentation's glossary calls CPython the canonical implementation of the Python programming language, as distributed on python.org, and says the name is used when it is necessary to distinguish it from others such as Jython or IronPython. The language reference describes it as the original and most-maintained implementation, written in C, where new language features generally appear first, and admits that CPython is the one implementation in widespread use, so its quirks are worth mentioning where it imposes limits. The alternatives the reference lists show the range: Jython is implemented in Java; Python for .NET actually embeds CPython; IronPython, created by Jim Hugunin, who also created Jython, compiles Python to .NET assemblies; and PyPy is written in Python itself and has a just-in-time compiler.
Its history is the history of the language. The documentation's licence page records that Guido van Rossum created Python in the early 1990s at Stichting Mathematisch Centrum (CWI) in the Netherlands as a successor to a language called ABC; in 1995 he continued at the Corporation for National Research Initiatives (CNRI) in Reston, Virginia; in May 2000 the core team moved to BeOpen.com as BeOpen PythonLabs and in October to Digital Creations, later Zope Corporation; and in 2001 the Python Software Foundation (PSF) was formed, a non-profit created to own Python-related intellectual property. Releases 0.9.0 to 1.2, from 1991 to 1995, belonged to CWI. The PSF's copyright notice is part of the licence every release carries; changes to the language and the interpreter are proposed as PEPs (Python Enhancement Proposals), which the Steering Council accepts or rejects; and the Developer's Guide names a release manager for each feature release.
CPython does not interpret source text line by line. It compiles a module to bytecode, which the glossary calls the internal representation of a Python program in the CPython interpreter, caches it in .pyc files so that a second run can skip compilation, and executes it on a virtual machine; the dis module lists the instructions. The glossary is explicit that bytecode is not expected to work between different Python virtual machines, nor to be stable between Python releases, which is why a cache or a virtual environment belongs to one interpreter version. Memory is managed by reference counting: when an object's count drops to zero it is deallocated, sys.getrefcount() shows the number, and since PEP 683 some objects are immortal, their counts never modified, so they live until the interpreter exits. A cyclic garbage collector detects and breaks reference loops, and 3.14 made its collection incremental.
For most of its life CPython was a straightforward interpreter, and the last five years have changed that. PEP 659, written by Mark Shannon in April 2021, introduced a specializing adaptive interpreter, one that speculatively specializes instructions on the types and values it is operating on and adapts when they change, without generating machine code. Python 3.11, the first release with it, was between 10 and 60 per cent faster than 3.10, 1.25 times on average on the standard benchmark suite. PEP 744, by Brandt Bucher and Savannah Ostrowski, added an experimental just-in-time (JIT) compiler in 3.13 built on a technique called copy-and-patch. Python 3.14 added an optional interpreter that uses tail calls between small C functions instead of one large switch statement, 3 to 5 per cent faster with Clang 19 or newer on x86-64 and AArch64, and shipped the experimental JIT in the Windows and macOS binaries. In 3.15 the official Windows 64-bit binaries use the tail-calling interpreter, and the reworked JIT is 7 to 8 per cent faster than the standard interpreter on x86-64 Linux and 11 to 12 per cent faster than the tail-calling one on AArch64 macOS, with individual benchmarks ranging from a 15 per cent slowdown to more than double the speed.
The global interpreter lock (GIL) is the CPython detail with the most practical consequences. In the glossary's words it is the mechanism that assures that only one thread executes Python bytecode at a time; it simplifies the implementation by making the object model, including built-in types such as dict, implicitly safe against concurrent access, at the expense of much of the parallelism of multi-processor machines. Some extension modules release it for computationally intensive work such as compression or hashing, and it is always released during input and output. For network automation this is the decisive fact: a script that spends its time waiting on SSH (Secure Shell) sessions, HTTP (Hypertext Transfer Protocol) requests or SNMP (Simple Network Management Protocol) replies gets real concurrency from threads or asyncio, while a script that parses gigabytes of logs in pure Python does not, and has traditionally reached for multiple processes instead.
PEP 703, by Sam Gross, created in January 2023 and accepted on 24 October 2023, proposed a build of CPython without the GIL, configured with --disable-gil. Removing the lock safely required replacing a great deal of machinery: biased reference counting, immortalization and a limited form of deferred reference counting instead of plain reference counts, a small per-object lock, critical sections in the interpreter, and changes to the mimalloc allocator. The PEP measured an overhead of 5 to 6 per cent for single-threaded programs and 7 to 8 per cent for multi-threaded ones on two processor families, with biased reference counting the largest cost. The Steering Council accepted it with an explicit proviso: a gradual rollout that breaks as little as possible and can be rolled back, entirely if necessary. PEP 779, accepted on 16 June 2025, set the criteria for the second of three phases: phase I, from 3.13, was an explicitly experimental free-threaded build; phase II makes it officially supported but optional, with targets of no more than 15 per cent slower and 20 per cent more memory; phase III, making it the default, is undecided.
Python 3.14, released on 7 October 2025, entered phase II. Its release notes say the PEP 703 implementation was finished, the specializing interpreter was enabled in free-threaded mode, and the single-threaded penalty fell to roughly 5 to 10 per cent depending on platform and compiler; the current free-threading guide gives an average from about 1 per cent on macOS aarch64 to 8 per cent on x86-64 Linux, and warns that memory use is higher. The build announces itself: python -VV and sys.version say free-threading build, and sys._is_gil_enabled() reports whether the lock is actually off, because the GIL can be turned back on with the PYTHON_GIL environment variable or -X gil, and is re-enabled automatically, with a warning, when the process imports a C extension that does not declare support for free threading. Python 3.15, released on 9 October 2026, added a stable application binary interface for free-threaded builds, abi3t, so that extensions built against the stable ABI (application binary interface) can also run on free-threaded builds, and its official macOS binaries now install free-threading support by default.
On 12 November 2026 python.org offered 3.15.2 as the current release, and the Developer's Guide listed 3.15 and 3.14 in their bugfix phase (first released on 9 October 2026 and 7 October 2025), 3.13 and 3.12 in their security phase, with end of life in October 2029 and October 2028, and 3.16 in development for a first release on 6 October 2027. Two habits follow for anyone who runs CPython in production. Check which interpreter and build is really in use, since the installers can put a free-threaded build beside the default one, and an extension that re-enables the GIL removes the benefit with only a warning to show for it. And treat the interpreter like any other dependency with a support window: bytecode caches, virtual environments and compiled wheels are tied to a version, and a branch past its end of life gets no further fixes from CPython's developers.
Also known as: CPython interpreter, reference implementation of Python
Sources
- Python documentation, Glossary, in the 3.15.2 documentation (read 2026-11-12), first read 2026-10-27: CPython, the canonical implementation distributed on python.org; bytecode cached in .pyc files, not expected to work between virtual machines nor to be stable between releases; global interpreter lock, simplifying the object model, released by some extensions for compression or hashing and always during I/O, disabled with --disable-gil since 3.13; free threading; immortal objects (PEP 683); reference count
- The Python Language Reference, 1.1 Alternate Implementations (read 2026-11-12), first read 2026-10-27: CPython, the original and most-maintained implementation, written in C, where new language features generally appear first; Jython; Python for .NET, which uses CPython; IronPython, created by Jim Hugunin, the original creator of Jython; PyPy
- What's New in Python 3.14 (read 2026-11-12), first read 2026-10-27: released on 7 October 2025; PEP 779, free-threaded Python officially supported; the PEP 703 implementation finished and the single-threaded penalty now roughly 5 to 10 per cent; the specializing adaptive interpreter enabled in free-threaded mode; a tail-calling interpreter 3 to 5 per cent faster with Clang 19 or newer; experimental JIT in the Windows and macOS binaries
- What's New in Python 3.15 (read 2026-11-12): released on 9 October 2026; UTF-8 as the default encoding (PEP 686); a stable ABI for free-threaded builds (abi3t; PEPs 803, 820 and 793); official macOS binaries install free-threading support by default; Windows 64-bit binaries use the tail-calling interpreter; the JIT 7 to 8 per cent faster on x86-64 Linux and 11 to 12 per cent on AArch64 macOS, with LLVM 21 at build time
- PEP 703, Making the Global Interpreter Lock Optional in CPython, Sam Gross, created 9 January 2023, resolution 24 October 2023, Final (read 2026-11-12): the --disable-gil build; biased reference counting, immortalization, deferred reference counting, per-object locks and mimalloc; overhead of 5 to 6 per cent single-threaded and 7 to 8 per cent multi-threaded on pyperformance 1.0.6; accepted by the Steering Council on condition of a gradual rollout that could be rolled back
- PEP 779, Criteria for supported status for free-threaded Python, Thomas Wouters, Matt Page and Sam Gross, created 13 March 2025, resolution 16 June 2025 (read 2026-11-12): phase I experimental from 3.13, phase II supported but optional, phase III default; a 15 per cent performance target and a 20 per cent memory target for phase II
- Python documentation, Python support for free threading (read 2026-11-12): optional free-threaded binaries in the macOS and Windows installers since 3.13; python -VV reports a free-threading build and sys._is_gil_enabled() reports the runtime state; PYTHON_GIL and -X gil; the GIL re-enabled with a warning by an extension not marked as supporting free threading; average overhead from about 1 per cent on macOS aarch64 to 8 per cent on x86-64 Linux; higher memory use
- PEP 659, Specializing Adaptive Interpreter, Mark Shannon, created 13 April 2021 (read 2026-11-12): an interpreter that speculatively specializes on the types and values it is operating on and adapts when they change, without generating machine code
- What's New in Python 3.11 (read 2026-11-12): Python 3.11 is between 10 and 60 per cent faster than 3.10, with an average 1.25x speed-up on the standard benchmark suite
- PEP 744, JIT Compilation, Brandt Bucher and Savannah Ostrowski, created 11 April 2024, Python-Version 3.13 (read 2026-11-12): the experimental JIT and its copy-and-patch technique, first presented at the 2023 core developer sprint
- Python Developer's Guide, Status of Python versions (read 2026-11-12): main (3.16, PEP 826) first release 2027-10-06; 3.15 bugfix, first release 2026-10-09, end of life 2031-10; 3.14 bugfix, 2025-10-07 to 2030-10; 3.13 security, 2024-10-07 to 2029-10; 3.12 security, 2023-10-02 to 2028-10; release managers
- Python documentation, History and License (read 2026-11-12): created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI) as a successor to ABC; CNRI from 1995; BeOpen PythonLabs in May 2000; Digital Creations in October 2000; the Python Software Foundation formed in 2001 to own Python-related intellectual property
- Python.org, Downloads (read 2026-11-12): Python 3.15.2 is the current download, after 3.15.1, 3.15.0 and 3.14.10