Skip to content

Compatibility

What works today, for a Python developer evaluating postpile. Updated 2026-11-12, each line checked by compiling a program that uses it and comparing its output with CPython's. The running account is notes/current-status.md in the repository. The reasoning behind each boundary is in an ADR (decision index).

One rule, the project's law, frames everything below: postpile refuses anything it cannot lower faithfully, with a diagnostic; nothing is approximated, so the tables have no "silently different" column. The practical inverse: if it compiles, it computes what CPython computes, held by a differential suite on every build. Three statuses appear:

  • Works: compiles and matches CPython, enforced by the suite.
  • Partial: a defined subset works; the boundary is stated and everything outside it is refused.
  • Refused: valid Python that does not lower; the compiler says why, and where there is one, what to write instead.

A program is a typed program: one mypy --strict accepts, with the annotations it requires. What the checker infers, postpile infers too.

Language and syntax

Works

Feature Note
Whole scripts to native executables top-level statements become the entry point (ADR-0003); a program split over several files builds; 1.8 ms startup for a hello-world (2026-11-10)
int CPython's integer: it grows past 64 bits in an executable (ADR-0075). In a library, an extension module, or with --no-grow-ints, it is 64 bits, checked in a debug and a release build and wrapping under --release --unchecked
Fixed-width scalars Int8–Int64, unsigned, Float16/32/64, Bool, Complex64/128 from postyp. Integers are machine integers that wrap at their width; Int64 is not int, which converts to it only through a cast
float, bool, the numeric builtins abs, round, divmod, pow, min, max, int(...), float(...), with CPython's results (ADR-0005)
str with CPython-exact formatting f-strings, % formatting with a literal format, the method surface (case, strip, find/replace, split/join, predicates), s[i], in, slices with CPython's clamping (ADR-0043, ADR-0044)
bytes literals, encode/decode with CPython's error messages, struct.pack, int.to_bytes/int.from_bytes (ADR-0015)
list[T] growable, element-owning; comprehensions; +, *, slicing and slice assignment, the method surface, del xs[i]; sum/min/max/sorted/len/any/all; key= and reverse=; comparison; lists of lists and of sets (ADR-0027, ADR-0057)
dict[K, V], set[T] insertion order and live views for a dict (ADR-0030); a set iterates in this runtime's order, which Python does not specify; a dict's values may be lists or sets (ADR-0073); collections.defaultdict (ADR-0071); an instance as a key
Tuples as values in locals, fields, lists and returns, unpacking, the swap, zip, enumerate (ADR-0045, ADR-0058)
Classes typed fields of any lowered type, single inheritance with super(), a method called through a base-class value dispatching on the instance's class (ADR-0065), @staticmethod, @classmethod, typing.Self, __slots__, read-only class attributes, @dataclass with its __init__, __repr__ and __eq__ (ADR-0023, ADR-0032)
Special methods __init__, __repr__, __str__, the arithmetic, bitwise and comparison operators, __getitem__/__setitem__, __eq__/__hash__ (ADR-0040, ADR-0063)
Optionals and unions closed tagged unions eliminated by match or by narrowing as the type checkers narrow: is None, guard clauses, assert, and/or (ADR-0029, ADR-0038); isinstance answers for a union of classes, testing the instance's class (ADR-0065), without narrowing it; it is refused on a tagged union such as int \| None
match over a tagged union with case int(n):-shaped arms (ADR-0029), over select(...) (ADR-0010), and over a number, a bool, a str or a bytes: literals and dotted names, True, False and None, captures, _, |, as, guards, and int()-style class patterns; a sequence or mapping pattern, and a match over a container or an instance, are refused
Exceptions try/except/else/finally, the builtin hierarchy, a script's own exception classes, with fields, raise, across both directions of the CPython boundary (ADR-0007)
Functions nested defs and closures, called in place or returned and passed as values with what they capture; nonlocal, for a variable bound once at the top of the enclosing function; module-level functions as values, passed, stored and returned through a Callable; a lambda as a key=, a map/filter/reduce function, bound to a name annotated Callable, returned from a function annotated -> Callable, or written in a list annotated list[Callable[...]], whose elements are then called (ADR-0070, ADR-0076)
Generators consumed where they are called, or as state machines when one recurses or is held in a name (ADR-0064, ADR-0072); generator expressions as the argument of the aggregate builtins
with, global, del of a local or an element with over a file, a TaskGroup, or an instance of a class whose __enter__ returns the bound value and whose __exit__ reads none of its three arguments and returns None; break and continue out of such a with are refused, as out of any try with a finally
Standard library math, time, random (bit for bit with CPython's), sys, copy, string's constants, heapq, bisect, text and binary files, standard input (ADR-0059, ADR-0061)
Arrays and ufuncs Array[T], @vectorize / @guvectorize with NumPy layout signatures, extension modules exporting every public function (ADR-0056)
CPython interop, both directions a compiled program calls CPython libraries through from python import ..., and CPython calls compiled code (ADR-0006)
Concurrency (repository checkout) channels, task groups, select, pygo.net on a C99 runtime; see the note at the end

Partial

  • A NaN in a list or as a dict key: x in [x] is False for a NaN x, where CPython's membership test (x is e or x == e) answers True. The same NaN inserted twice makes two dict entries where CPython makes one. A compiled float has no identity for the is half (A192).
  • f-string format specs: fill, alignment, width, 0-fill, , grouping, precision and the d, f, e, g, x, b and o types are CPython-byte-exact; a sign, _ grouping, # and % are refused, because a spec ignored without a diagnostic prints the wrong bytes (ADR-0039).
  • bytearray: a local buffer read and written by index, measured by len and copied out by bytes(...); its methods are refused.
  • collections.deque: a local appended to, extended, popped with pop() or popleft(), measured, tested, iterated and searched with in; appendleft and the other methods are refused.
  • Exception classes: a body of pass, a docstring, or one __init__ storing fields into self; an __init__ that calls super().__init__(...) is refused.
  • The aggregate builtins over a set: sorted(s), min(s), max(s) and sum(s) compile, with key= or without, over any set. They walk it in this runtime's order, which Python leaves unspecified, so a float total may round differently from CPython's (ADR-0028).
  • Printing an instance with no __repr__: compiles, and prints an address as CPython does; the address differs, as it does between two CPython runs.

Refused, with a diagnostic

  • By the spec or by decision: *args and **kwargs in a signature; a * or ** argument at a call, except f(**d) of a local dict[str, V] (ADR-0030); a lambda bound to an unannotated name; del of an attribute; is between instances, id() and __del__ (while reference cycles leak); stores to a class attribute; a list or dict mixing element types without a declared union; an int stored into a float slot, declared or not, where CPython keeps the int (write 0.0 or float(n), A190); a constant past 64 bits in a library, an extension module or a --no-grow-ints executable (A193); int ** int with a negative exponent, refused where its sign folds and stopped at run time otherwise, since CPython's answer is a float (ADR-0020); comparing two lists of floats, where CPython's identity test decides at a NaN; relative imports.
  • Not lowered yet: @property and the special methods not listed above (__len__, __contains__, __iter__, …); @dataclass options (frozen=True, order=True, …) and field(...); a dict value that is a dict or a tuple, a list element that is a dict; == between dicts; min/max over a list of lists, in over one, and a key= returning a list; min/max with default=; xs *= n on a list; repr of a caught exception; the f-string conversion !a; format on a computed string; split(None, n); dict(pairs) of a list of pairs held in a name; a for over a generator expression; print(..., flush=); % formatting's +, space and # flags, a %(key) mapping, a * width, and %c of a str; match with class patterns over a union of classes; a function value in a field, a dict, a set or a tuple, and print, in, index, count, remove and the ordering reducers over a list of functions; next(), send, throw and close on a generator, a yield inside a try or a with, generator methods, and a parameter or field annotated Iterator[T]; decorators other than @staticmethod, @classmethod and @dataclass; inheriting from a class of another module, and from mod import * of a POST module; a module-level x = None typed only by an assignment in a function; a file's + modes, seek, tell, flush and attributes (f.name, f.closed).
  • Stopped at run time, with a message, where CPython computes or raises and the compiled program does not yet: ord of a str whose length is not one; splitlines with a flag past 64 bits; an array("B") element past 64 bits; a range whose bounds come within 2**48 of -2**63 in an executable; and any other int past 64 bits reaching an operation lowered over machine integers only, which the stop names (ADR-0075). An index, a repetition count, a width or a length past 64 bits raises CPython's exception, and a slice or search bound past 64 bits is clamped as CPython clamps it.

Nothing on these lists is silently mis-lowered; that is the point of the lists. The divergences that compile with a documented difference are under Partial above.

The standard library, module by module

A module function postpile does not compile is refused with the spelling that reaches it through CPython (from python import math). A function named without its call (f = math.sqrt) is refused. The error messages are those of the CPython that runs the test suite (ADR-0059).

  • math: the float functions with CPython's domain and range errors; floor, ceil and trunc returning an int; radians, degrees, isnan, isinf, isfinite; the constants; log(x, base), and log, log2, log10 of an int with CPython's message for a non-positive one. hypot is refused, since CPython's correctly rounded algorithm can differ from libm's in the last bit.
  • time: time, perf_counter, monotonic, process_time and sleep, which refuses a NaN or a negative length with CPython's ValueError.
  • random, bit for bit with CPython's module-level generator: seed with an int or no argument, random, randrange, randint, choice and shuffle of a list, uniform, triangular, and sample of a list. Refused: a float, str or bytes seed; triangular with an int low and a mode; choice of a str; sample with counts=; choices, gauss and the other distributions, getrandbits, and Random instances. Compiled into an executable only.
  • sys: argv, exit (a SystemExit that except Exception does not catch), maxsize, setrecursionlimit (checked, and otherwise without effect, since a compiled call uses the C stack), stdout.write, stderr.write, stdout.flush, and stdin with files (ADR-0061). argv and exit are compiled into an executable only.
  • copy: copy and deepcopy of an instance, a list, a dict or a set, with CPython's sharing and cycle behaviour. Refused: a deepcopy memo, a union or a tuple, and copy.replace.
  • heapq and bisect: every function except those taking key=, written in POST over CPython's comparison order, with its messages.
  • string: the nine constants. The functions and Template go through CPython.
  • array: only array("B", xs).tofile(f), with CPython's OverflowError for a value outside 0 to 255.
  • struct: pack with a literal format, an explicit byte order and integer, ? or x codes; struct.error is caught by except struct.error: and except Exception:. Constructing a struct.error is refused.
  • collections: deque as listed under Partial; defaultdict (ADR-0071).
  • itertools: product consumed by a for, a comprehension or a consuming call, with repeat= a literal. A product held in a name or passed along is refused.

Memory

Memory is reference-counted per task, with deterministic release. Instances, strings, bytes, big ints, lists, dicts, sets and handled exception records are released when nothing holds them, and verified by per-heap counters plus AddressSanitizer. CPython handles are not released. A reference cycle leaks by decision (ADR-0024); the exit report says so.

Backends and platforms

Backend Needs Status
c (reference, default) a C compiler, or none with postpile[bundled], which falls back to zig cc Works
qbe nothing: the bundled QBE builds once on first use and is preferred to one on PATH Works, byte-identical to c, slower
llvm llvmlite (the llvm extra) Works, byte-identical to c
--target wasm32-wasip1 zig (PATH or the bundled extra), a WASI engine to run it The C backend's output as a WASI command or reactor (the WebAssembly target)

Platforms tested: macOS (arm64, Apple clang) every day, and Linux (x86_64, Debian with GCC 14) before a release; Python ≥ 3.12, including 3.14 and the free-threaded 3.14t. Windows is untested. The concurrency surface currently requires a repository checkout; the installed wheel refuses import pygo with a diagnostic naming the way out.