Stackless Python

Alternative Python implementation


title: "Stackless Python" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["concurrent-computing", "python-(programming-language)-implementations", "software-using-the-python-software-foundation-license"] description: "Alternative Python implementation" topic_path: "technology/computing" source: "https://en.wikipedia.org/wiki/Stackless_Python" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Alternative Python implementation ::

::data[format=table title="Infobox software"]

FieldValue
nameStackless Python
authorChristian Tismer
developerAnselm Kruis
released
latest release version
latest release date
latest preview version3.9.0 alpha 0
programming languageC, Python
operating systemLinux, macOS, Windows
genreInterpreter
licensePython Software Foundation License
website
::

| name = Stackless Python | logo = | screenshot = | caption = | collapsible = | author = Christian Tismer | developer = Anselm Kruis | released = | latest release version = | latest release date = | latest preview version = 3.9.0 alpha 0 | latest preview date = | frequently updated = | programming language = C, Python | operating system = Linux, macOS, Windows | platform = | size = | language = | status = | genre = Interpreter | license = Python Software Foundation License | website =

Stackless Python, or Stackless, was a Python programming language interpreter. Its GitHub repository has been archived since February 2025, and the project has been officially discontinued.

It was so named because it avoids depending on the C call stack for its own stack. In practice, Stackless Python uses the C stack, but the stack is cleared between function calls. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associated with usual operating system threads. In addition to Python features, Stackless also adds support for coroutines, communication channels, and task serialization.

Design

With Stackless Python, a running program is split into microthreads that are managed by the language interpreter itself, not the operating system kernelcontext switching and task scheduling is done purely in the interpreter (these are thus also regarded as a form of green thread). Microthreads manage the execution of different subtasks in a program on the same CPU core. Thus, they are an alternative to event-based asynchronous programming and also avoid the overhead of using separate threads for single-core programs (because no mode switching between user mode and kernel mode needs to be done, so CPU usage can be reduced).

Although microthreads make it easier to deal with running subtasks on a single core, Stackless Python does not remove CPython's global interpreter lock (GIL), nor does it use multiple threads and/or processes. So it allows only cooperative multitasking on a shared CPU and not parallelism (preemption was originally not available but is now in some form). To use multiple CPU cores, one would still need to build an interprocess communication system on top of Stackless Python processes.

Due to the considerable number of changes in the source, Stackless Python cannot be installed on a preexisting Python installation as an extension or library. It is instead a complete Python distribution in itself. The majority of Stackless's features have also been implemented in PyPy, a self-hosting Python interpreter and JIT compiler.

Use

Although the whole Stackless is a separate distribution, its switching functionality has been successfully packaged as a CPython extension called greenlet. It is used by a number of libraries (e.g. gevent) to provide a green threading solution for CPython. Python since has received an alternative native solution for asynchronous programming running on a single thread: await/async.

Stackless is used extensively in the implementation of the Eve Online massively multiplayer online game as well as in IronPort's mail platform.

References

References

  1. "The story of stackless Python".
  2. "About Stackless".
  3. "Application-level Stackless features — PyPy documentation".
  4. "greenlet: Lightweight concurrent programming — greenlet 0.4.0 documentation".
  5. "What is gevent? — gevent 1.3.0.dev0 documentation".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

concurrent-computingpython-(programming-language)-implementationssoftware-using-the-python-software-foundation-license