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]isFalsefor a NaNx, where CPython's membership test (x is e or x == e) answersTrue. The same NaN inserted twice makes two dict entries where CPython makes one. A compiled float has no identity for theishalf (A192). - f-string format specs: fill, alignment, width,
0-fill,,grouping, precision and thed,f,e,g,x,bandotypes 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 bylenand copied out bybytes(...); its methods are refused.collections.deque: a local appended to, extended, popped withpop()orpopleft(), measured, tested, iterated and searched within;appendleftand the other methods are refused.- Exception classes: a body of
pass, a docstring, or one__init__storing fields intoself; an__init__that callssuper().__init__(...)is refused. - The aggregate builtins over a set:
sorted(s),min(s),max(s)andsum(s)compile, withkey=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:
*argsand**kwargsin a signature; a*or**argument at a call, exceptf(**d)of a localdict[str, V](ADR-0030); a lambda bound to an unannotated name;delof an attribute;isbetween 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 afloatslot, declared or not, where CPython keeps the int (write0.0orfloat(n), A190); a constant past 64 bits in a library, an extension module or a--no-grow-intsexecutable (A193);int ** intwith 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:
@propertyand the special methods not listed above (__len__,__contains__,__iter__, …);@dataclassoptions (frozen=True,order=True, …) andfield(...); a dict value that is a dict or a tuple, a list element that is a dict;==between dicts;min/maxover a list of lists,inover one, and akey=returning a list;min/maxwithdefault=;xs *= non a list;reprof a caught exception; the f-string conversion!a;formaton a computed string;split(None, n);dict(pairs)of a list of pairs held in a name; aforover a generator expression;print(..., flush=);%formatting's+, space and#flags, a%(key)mapping, a*width, and%cof a str;matchwith class patterns over a union of classes; a function value in a field, a dict, a set or a tuple, andprint,in,index,count,removeand the ordering reducers over a list of functions;next(),send,throwandcloseon a generator, ayieldinside atryor awith, generator methods, and a parameter or field annotatedIterator[T]; decorators other than@staticmethod,@classmethodand@dataclass; inheriting from a class of another module, andfrom mod import *of a POST module; a module-levelx = Nonetyped only by an assignment in a function; a file's+modes,seek,tell,flushand attributes (f.name,f.closed). - Stopped at run time, with a message, where CPython computes or raises and the compiled program does not yet:
ordof a str whose length is not one;splitlineswith a flag past 64 bits; anarray("B")element past 64 bits; arangewhose bounds come within 2**48 of-2**63in an executable; and any otherintpast 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,ceilandtruncreturning an int;radians,degrees,isnan,isinf,isfinite; the constants;log(x, base), andlog,log2,log10of an int with CPython's message for a non-positive one.hypotis refused, since CPython's correctly rounded algorithm can differ from libm's in the last bit.time:time,perf_counter,monotonic,process_timeandsleep, which refuses a NaN or a negative length with CPython'sValueError.random, bit for bit with CPython's module-level generator:seedwith an int or no argument,random,randrange,randint,choiceandshuffleof a list,uniform,triangular, andsampleof a list. Refused: a float, str or bytes seed;triangularwith an intlowand a mode;choiceof astr;samplewithcounts=;choices,gaussand the other distributions,getrandbits, andRandominstances. Compiled into an executable only.sys:argv,exit(aSystemExitthatexcept Exceptiondoes not catch),maxsize,setrecursionlimit(checked, and otherwise without effect, since a compiled call uses the C stack),stdout.write,stderr.write,stdout.flush, andstdinwith files (ADR-0061).argvandexitare compiled into an executable only.copy:copyanddeepcopyof an instance, a list, a dict or a set, with CPython's sharing and cycle behaviour. Refused: adeepcopymemo, a union or a tuple, andcopy.replace.heapqandbisect: every function except those takingkey=, written in POST over CPython's comparison order, with its messages.string: the nine constants. The functions andTemplatego through CPython.array: onlyarray("B", xs).tofile(f), with CPython'sOverflowErrorfor a value outside 0 to 255.struct:packwith a literal format, an explicit byte order and integer,?orxcodes;struct.erroris caught byexcept struct.error:andexcept Exception:. Constructing astruct.erroris refused.collections:dequeas listed under Partial;defaultdict(ADR-0071).itertools:productconsumed by afor, a comprehension or a consuming call, withrepeat=a literal. Aproductheld 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.