sys module
The module exposes only the attributes listed below; every other sys.*
access raises AttributeError.
sys.version— the string"3.14.0 (Monty)".sys.version_info— named tuple(major=3, minor=14, micro=0, releaselevel='final', serial=0).sys.hexversion—0x030E00F0, the packed form of thatversion_info.sys.api_version—1013, CPython 3.14’s C API version. Monty has no C API, so nothing can be loaded against it; the number is reported only so version-gated code reads what it expects.sys.argv— a one-element list holding the script name, with any host directory component stripped (['main.py']), sosys.argv[0]is what__file__places under the working directory. Monty runs no command line, so there is never an argument afterargv[0]; passing arguments from the host is not supported yet. The list is mutable as in CPython, butimportbuilds a fresh module every time, so edits to it do not survive a secondimport sys(see modules.md).sys.platform— the string"monty", not"linux"/"darwin"/"win32". Code that branches on the host OS will not work; the sandbox does not expose which OS it runs on.sys.copyright— Monty’s copyright line, not CPython’s.sys.builtin_module_names— every module Monty can import, since they are all compiled into the interpreter. CPython lists only its C modules, so the tuple differs: it includesjson,re,typingand the other modules that are pure Python in CPython, and omitsbuiltins,timeand everything else Monty does not implement. See modules.md for the module list.sys.maxsize—2**63 - 1on every target, including 32-bit wasm where the real container ceiling is lower. Resource limits bind long before either.sys.maxunicode—1114111(U+10FFFF), as in CPython.sys.byteorder— always"little"; Monty builds for no big-endian target.sys.float_info— the IEEE 754 binary64 properties of thef64Monty stores floats in, so the values match CPython.roundsis1(round-to-nearest) and nothing in the sandbox can change it.sys.float_repr_style— always"short".sys.executable,sys.prefix,sys.exec_prefix,sys.base_prefix,sys.base_exec_prefix— the empty string. The sandbox has no install tree, and CPython documents the empty string for a path it cannot determine.prefix == base_prefix, so the usual virtualenv test reports “not in one”.sys.platlibdir—"lib", joined onto asys.prefixthat is empty.sys.abiflags— the empty string; Monty has no ABI. CPython does not define this attribute at all on Windows.sys.dont_write_bytecode—True, where CPython defaults toFalse. Monty never writes bytecode to disk.sys.pycache_prefix— alwaysNone.sys.flags— the same 18 fields CPython 3.14 reports, in the same order. Monty is started with no command line, so every switch reads0/False, includingutf8_modeandsafe_patheven though the sandbox has no other encoding and nosys.path. Two fields describe Monty rather than an unset switch:dont_write_bytecodeis1, agreeing withsys.dont_write_bytecode, andhash_randomizationis0because Monty seeds no hashes — CPython reports1by default.int_max_str_digitsis4300, the limit Monty enforces, but there is nosys.set_int_max_str_digitsto change it. CPython 3.14 carries three further fields outside the sequence —gil,thread_inherit_contextandcontext_aware_warnings, reachable by name but not by index and not counted bylen(). They describe the GIL and thread-context machinery Monty does not have, so they raiseAttributeError; the 18-element sequence itself matches CPython’s.sys.stdout/sys.stderr— opaque marker objects with no methods. They cannot be written to via.write(), andsys.stdout.flush()and the rest raiseAttributeError. They are useful only asprint(..., file=...), which routes output to that stream through the host print callback (see print.md).
Accessing an attribute the module does not define raises Monty’s generic
AttributeError: 'module' object has no attribute '<name>', where CPython says
module 'sys' has no attribute '<name>'.
path, modules, exit, exc_info, getrecursionlimit,
getsizeof, getrefcount, intern, displayhook, excepthook,
settrace, setprofile, stdin, __stdout__, _getframe, audit.
hash_info, int_info and thread_info describe CPython’s own C
implementation — its string and integer hashing, its bignum digit layout, its
thread library — none of which Monty shares, so they raise AttributeError
rather than reporting fabricated values. In particular hash_info cannot be
used to predict Monty’s hashes, which differ from CPython’s (see
builtins.md).
ps1 and ps2 are absent, so hasattr(sys, 'ps1') correctly reports that the
sandbox is not an interactive prompt.
The private install-layout attributes _base_executable, _framework, _git,
_home and _stdlib_dir are absent for the same reason as sys.prefix and
friends: there is no install tree.
Production builds do not expose sys.setrecursionlimit. Test builds expose a
lowering-only hook so shared fixtures can force deterministic recursion errors;
it cannot raise the host-configured ceiling. See
resource_limits.md.