Research

Publications

Dynamically Checked Deep Immutability in Python

2026
Fridtjof Stoldt, Sylvan Clebsch, Matthew A. Johnson, Matthew J. Parkinson, Tobias Wrigstad
Proceedings of the ACM on Programming Languages (PLDI)
Abstract

Immutability is common in the programming mainstream: deep immutability is the default in functional languages while imperative languages typically provide opt-in support for shallow immutability, usually enforced through static checking.

Python is a dynamic imperative language where mutability is inherent: not only are most objects mutable, but programs themselves—modules, classes, functions—are represented by mutable objects at run-time, and libraries routinely rely on this mutability. This makes adding immutability to Python a significant challenge.

This paper presents the design and implementation of deep immutability for Python. Our primary motivation is to permit multiple sub-interpreters to directly share object references, which currently requires costly serialisation. Sharing via immutability introduces a soundness challenge, as a violation could corrupt the interpreter’s state.

We identify numerous challenges that stem from decades of design decisions that did not anticipate immutability, and show how they can be overcome through two complementary techniques: detachment, which severs run-time links that would cause immutability to propagate too widely, and freezability, which gives objects run-time control over whether and how they may become immutable. Together, these principles form a general design pattern for deep immutability in dynamic languages. We validate our design with an implementation on CPython 3.15 that is backwards-compatible with existing programs and enables direct, zero-copy sharing of immutable objects across sub-interpreters.

Concurrency Safety Dynamic languages Immutability Python

Dynamic Region Ownership for Concurrency Safety

2025
Fridtjof Stoldt, Brandt Bucher, Sylvan Clebsch, Matthew A. Johnson, Matthew J. Parkinson, Guido van Rossum, Eric Snow, Tobias Wrigstad
Proceedings of the ACM on Programming Languages (PLDI)
Abstract

The ways in which the components of a program interact with each other in a concurrent setting can be considerably more complex than in a sequential setting. The core problem is unrestricted shared mutable state. An alternative to unrestricted shared mutable state is to restrict the sharing using Ownership. Ownership can turn what would have been a race into a deterministic failure that can be explained to the programmer. However, Ownership has predominantly taken place in statically typed languages.

In this paper, we explore retrofitting an existing dynamically typed programming language with an ownership model based on regions. Our core aim is to provide safe concurrency, that is, the ownership model should provide deterministic dynamic failures of ownership that can be explained to the programmer. We present a dynamic model of ownership that provides ownership of groups objects called regions. We provide dynamic enforcement of our region discipline, which we have implemented in a simple interpreter that provides a Python-like syntax and semantics, and report on our first steps into integrating it into an existing language, Python.

Concurrency Safety Dynamic languages Ownership Python

Grants

Programming Languages Mentoring Workshop @ PLDI 2025 Travel Grant

2025
SIGPLAN

Presentations

Immutability: Fast and Safe Sharing of Data Across Subinterpreters

2026

EuroPython 2026, Krakòw

with Tobias Wrigstad
Abstract

Python supports parallelism through multiple subinterpreters. Parallelism though subinterpreters avoid the restrictions of a single GIL, and isolating parallel processes from each other is safe from data-races. The downside is that subinterpreter isolation comes with a high cost: sending objects across subinterpreters typically involves pickling and copying which has negative impact on performance with both CPU and memory overheads. This talk is about PEP795 which adds immutability to Python, which permits subinterpreters to transfer and share immutable objects directly by reference.

We will present the design and rationale for immutability in Python, the API for creating and managing immutable state, decorators for communicating immutability in code, as well as opting out of immutability where necessary. We will also discuss our prototype implementation on-top of Python 3.15, and demonstrate how immutable sharing across subinterpreters improves performance, and compare the speed of freezing (the act of making objects immutable) to pickling and unpickling.

Thinking about the post era of Free-threaded Python

2026

Python’s Language Summit, EuroPython 2026, Krakòw

with Donghee Na, Tobias Wrigstad
Abstract

In the free-threading era, Python users will need high-level concurrency primitives that make concurrent programming easier and safer.

This session will discuss what kinds of primitives we could provide in the Python standard library, and how to make them feel natural for everyday Python users.

Dynamically Checked Deep Immutability in Python

2026

PLDI 2026, Colorado, USA

Data-Race Free Python

2026

PLISS 2026, Italy

with Tobias Wrigstad

Dynamic Region Ownership for Concurrency Safety

2025

PLDI 2025, Seoul, South Korea

Ownership Patterns in Rust

2024

Intel, Stockholm, Sweden

with Amanda Stjerna

Region-Based Ownership for Dynamic Programming Languages

2024

Microsoft Research, Cambridge, England