Primitive Type Cheat Sheet

The following table summarizes RPython’s primitive types and corresponding low-level types, FFI types, and C types.

RPython Type (Primitive)

LL Type

FFI Type

C Type (64-bit Linux)

int

Signed

SIGNED

long

long

Signed

LONG

long

r_uint

Unsigned

UINT

unsigned long

r_ulonglong

UnsignedLongLong

ULONGLONG

unsigned long

r_longlong

SignedLongLong

LONGLONG

long long

r_longlonglong

SignedLongLongLong

__INT128_T

__int128_t

r_singlefloat

SingleFloat

FLOAT

float

float

Float

DOUBLE

double

r_longfloat

LongFloat

LONGDOUBLE

long double

char

Char

CHAR

char

bool

Bool

N/A

boot_t

NoneType

Void

VOID

void

unicode

UniChar

WCHAR_T

wchar_t

  • RPython types start with r_ can be imported from the rpython.rlib.rarithmetic module.

  • Low-level types can be imported from the rpython.rtyper.lltypesystem.lltype module.

  • FFI types can be imported from the rpython.rtyper.lltypesystem.rffi module.

The definitions of these types can be found in the following source code.

In addition to these primitive types, there are other types like pointer types for FFI.