












  • 21
  • 6
  • 3
  • 2

80 Answers 80


JavaScript Shell

This will make the language completely unusable.


Isn't it nice how JavaScript has such a nice function to destroy itself?

This is pretty simple, the clear function completely empty an object. this refers to the global object clearing out everything including constructors and functions.

Because this clears everything, doing anything, even defining a literal will throw an error, making the language completely useless: Example Usage *REPL environment not required. Uses the SpiderMonkey engine (shell not browser), the original JS engine.

  • 5
    \$\begingroup\$ That clear function seems to be a SpiderMonkey-shell-specific addition, not a generic JavaScript thing. It certainly doesn't appear in the ES5 spec § Function Properties of the Global Object. I tried this with node and got a "ReferenceError: clear is not defined". In Chrome's and Firefox's console, the clear function just clears the console, regardless of what arguments it is passed. Or perhaps the tool you used complied to a version of ECMAScript older than 5.1? \$\endgroup\$ – Anko Jan 22 '16 at 1:01
  • 2
    \$\begingroup\$ Could you instead amend the statement “Isn't it nice how JavaScript has such a nice function to destroy itself”? JavaScript doesn't have that function, only the SpiderMonkey implementation does. \$\endgroup\$ – Anko Jan 22 '16 at 1:12
  • 1
    \$\begingroup\$ @Anko SpiderMonkey is JavaScript though, it comes bundled with Firefox (SpiderMonkey is Firefox's JS engine). I'll write up a version for node.js, etc. later, when I have time \$\endgroup\$ – Downgoat Jan 22 '16 at 1:15
  • 7
    \$\begingroup\$ I think you're confusing JavaScript (the language) with SpiderMonkey (one of the many implementations of the language). Extreme allegory: While I could write a crazy implementation of C in which all invocations of undefined behaviour result in printing the full text of the Declaration of Human Rights, I probably wouldn't be able to argue that my C submission to "golf the UDHR" that just dereferences a null pointer is a valid C solution. :) \$\endgroup\$ – Anko Jan 22 '16 at 1:42
  • 8
    \$\begingroup\$ @Anko As a per site rule, a language is defined by its implementation. If an answer works consistently in at least one implementation that was published before the question, then it is acceptable. See here and here. (So the code is valid. But I'll not comment on that specific wording.) \$\endgroup\$ – jimmy23013 Feb 23 '16 at 1:21



I know this isn't code golf, but the right tool for the job, you know...

The user's code can be inserted after the !.

Emmental is an interesting esolang which is based on rewriting the interpreter. Every single symbol (including the built-in ones) can be redefined as an arbitrary Emmental program. The language relies on this feature so much that it doesn't provide any looping constructs. Instead, you define recursive commands which appear in their own definitions.

This redefinition happens via !, which reads a character from the stack, and then reads a string from the stack until it encounters a ;. The character is then redefined to mean the program represented by that string.

That means, we can disable Emmental's looping features by redefining ! itself as the empty program. While all other Emmental code still runs perfectly fine, and many of the criteria of a programming language are still fulfilled, it is impossible to redefine any more symbols. Without this feature (and therefore, without being able to loop), Emmental can no longer test whether a number is prime.

  • 50
    \$\begingroup\$ Disabling the single defining feature of the language: pure genius. This certainly is the right tool for the job. +1 \$\endgroup\$ – ETHproductions Oct 18 '15 at 16:49


One can completely kill PHP by setting the memory limit to 1.

It will completely die.

Try this:


    //code here

This shouldn't even throw any error, since there isn't enough memory for that.

You can read more about the memory_limit directive

If the previous one is invalid, one can use output buffers:


    //code here


This completely removes any output. Since the output buffer is still open, some other things accidentally left after the code won't be shown as well.

Using @fschmengler's idea:

    define('OB_START_LEVEL', ob_get_level());
    ob_start(function(){return'';}, -1, PHP_OUTPUT_HANDLER_CLEANABLE);
    //or, for PHP <5.3:
    //ob_start(create_function('','return"";'), -1, PHP_OUTPUT_HANDLER_CLEANABLE);

    //code here

    while(ob_get_level() > OB_START_LEVEL) ob_clear();

This will avoid the problem of deleting the automatically started output buffer, used to catch the output to be compressed.

This also prevents that the output buffer is deleted or flushed (sent to the browser). To re-inforce that, an output handler is added, that always returns an empty string.
Running ob_end_flush(); echo "Hello, world!"; won't produce anything, but would send the output with a plain ob_start();.

Thanks to @LucasTrzesniewski for exposing this issue!

  • 1
    \$\begingroup\$ Since you can have severel levels of output buffering, the second one does not work. Often, while(ob_get_level()) ob_end_flush(); is used in frameworks to flush all output buffers that may have been left open accidently. \$\endgroup\$ – Fabian Schmengler Oct 18 '15 at 18:35
  • \$\begingroup\$ @fschmengler That will cause problems with automatically opened output buffers, usually used to compress the output using gzip. Which in turn will defeat the purpose. \$\endgroup\$ – Ismael Miguel Oct 18 '15 at 18:38
  • \$\begingroup\$ This can be bypassed with: ob_end_flush(); echo "Hello, world!"; \$\endgroup\$ – Lucas Trzesniewski Oct 20 '15 at 19:54
  • 8
    \$\begingroup\$ Why am I not surprised that PHP ended up towards the top of the vote-chart :) \$\endgroup\$ – MonkeyZeus Oct 20 '15 at 20:47
  • 48
    \$\begingroup\$ This shouldn't even throw any error, since there isn't enough memory for that. LOL'ed at that :) \$\endgroup\$ – ETHproductions Oct 28 '15 at 16:21

x86 machine code in real mode (=> almost any DOS program)

00000000  6a 00 07 b9 00 04 30 c0  31 ff f3 aa              |j.....0.1...|


push 0
pop es
mov cx,400h
xor al,al
xor di,di
rep stosb

I hope you weren't too attached to your interrupt table.

  • 75
    \$\begingroup\$ Sir, if I may interrupt you for a few cycles so I may fini.... \$\endgroup\$ – Luminous Oct 20 '15 at 12:57
  • 6
    \$\begingroup\$ So what if the first instruction of my inserted code is cli, and then I fix the interrupt table, and go on to compute some primes, etc? \$\endgroup\$ – Nate Eldredge Oct 21 '15 at 16:22
  • 3
    \$\begingroup\$ @NateEldredge: the next step is to jail the rest of the code to ring 3 with no trampoline back to ring 0; I'll see if I manage to put together a working example (another possibility would be to scan the whole address space and NOP-out all the cli (and inp and outp just for good measure), but I don't know if that would be allowed by the rules. \$\endgroup\$ – Matteo Italia Oct 21 '15 at 19:19
  • 2
    \$\begingroup\$ At least as it stands, this won't stop a program from writing directly to the screen buffer (which was pretty common under DOS). \$\endgroup\$ – Jerry Coffin Oct 21 '15 at 20:28
  • 1
    \$\begingroup\$ @NateEldredge: the rules aren't really clear on this, and if you look around most answers actually consist in modifications to the environment that generate a runtime error of some type on trivial instructions (the JS clear(this);, the memory limit in PHP, the recursion limit in Python, the sandboxed environment in Python and many others), I wouldn't see this as a problem. \$\endgroup\$ – Matteo Italia Oct 22 '15 at 5:54


import java.io.*;
import java.lang.reflect.*;
public class Test2 {
        args = new String[0];
        System.setOut(new PrintStream(new ByteArrayOutputStream()));
        System.setErr(new PrintStream(new ByteArrayOutputStream()));
        System.setIn(new ByteArrayInputStream(new byte[0]));

        Field modifiersField = Field.class.getDeclaredField("modifiers");

        Class<?> fdClass = java.io.FileDescriptor.class;
        Field outField = fdClass.getDeclaredField("out");
        modifiersField.setInt(outField, outField.getModifiers() & ~Modifier.FINAL);
        outField.set(null, new FileDescriptor());
        Field errField = fdClass.getDeclaredField("err");
        modifiersField.setInt(errField, errField.getModifiers() & ~Modifier.FINAL);
        errField.set(null, new FileDescriptor());
        Field inField = fdClass.getDeclaredField("in");
        modifiersField.setInt(inField, inField.getModifiers() & ~Modifier.FINAL);
        inField.set(null, new FileDescriptor());

        System.setSecurityManager(new SecurityManager(){
            private boolean exitAllowed = false;
            public void checkPermission(java.security.Permission perm) {
                String name = perm.getName();
                        || name.equals("setSecurityManager")
                        || name.equals("writeFileDescriptor")
                        || name.equals("readFileDescriptor")
                        || name.equals("suppressAccessChecks")
                        || (perm instanceof FilePermission
                            && name.startsWith("/proc/self/fd/"))){
                    throw new SecurityException("Nope");
                if(name.startsWith("exitVM") && !exitAllowed){
                    exitAllowed = true;
            public void checkExec(String cmd){
                throw new SecurityException("nope");

        // program here

Edit: Counter-countermeasures are making this giant :(

Redirects stdin and stdout to null streams and replaces args with an empty array. Also uses enormous amounts of reflection hacks to make sure the standard IO is truly hidden. Finally, it sets a security manager to make sure the standard IO can't be recreated and that makes sure programs can't set the exit code.

  • 6
    \$\begingroup\$ Negative. \$\endgroup\$ – Mego Oct 18 '15 at 15:42
  • 5
    \$\begingroup\$ Playing with reflection is almost always reversible. \$\endgroup\$ – Mego Oct 18 '15 at 17:10
  • 10
    \$\begingroup\$ +1 Personally I don't consider the /proc workarounds as real deal breakers because I don't use Linux and neither my Unix OS not my Windows OS has a /proc filesystem. \$\endgroup\$ – Jerry Jeremiah Oct 19 '15 at 18:46
  • 68
    \$\begingroup\$ Summary of this challenge so far: 1. JavaScript, 12 chars. 2. Emmental, 6 chars. 3. x86, 12 bytes. 4. Python, 42 chars. 5. Java, 2264 chars! Why am I not surprised? \$\endgroup\$ – ceased to turn counterclockwis Oct 21 '15 at 20:20
  • 34
    \$\begingroup\$ @ceasedtoturncounterclockwis It's because java is more secure so it's harder to break :D \$\endgroup\$ – Pierre Arlaud Oct 22 '15 at 12:45



In Lua, _ENV is the environment that all global variables, functions, tables, etc are stored in. Defining it to just be an empty string means you can't define anything new, and all functions and variables are wiped. This means you can not output anything, take in input, or pretty much do anything.

  • 1
    \$\begingroup\$ Does _ENV=5 work? If so, it's one character shorter. \$\endgroup\$ – user253751 Oct 22 '15 at 0:54
  • 7
    \$\begingroup\$ @immibis True, but this is a popularity contest, not a code length contest. PS - Trust you to home in on the Lua answer. \$\endgroup\$ – Pharap Oct 22 '15 at 1:08
  • \$\begingroup\$ +1 for Lua. Doesn't $_G=nil$ do more or less the same as well? \$\endgroup\$ – Doddy Oct 23 '15 at 7:19
  • \$\begingroup\$ @Doddy Nope, because _G is just a copy of _ENV you can use to look up variables and stuff like that - it isn't actually the environment. You could, however, do _G=nil and then set the environment to _G, and that would have the same effect. \$\endgroup\$ – TreFox Oct 23 '15 at 10:48
  • \$\begingroup\$ Not entirely true. If you have a backup somewhere in local variable, you can restore it. And you can still define local variables and even call string-related functions! \$\endgroup\$ – val says Reinstate Monica Jun 10 at 19:57

Shakespeare Programming Language

Have Fun Mr Parser.

Romeo, a young man of Verona.
Juliet, a young lady of Verona.
Hamlet, another character which causes the crash.

Act I
Scene I The crash.

[Enter Romeo]
[Enter Juliet]
[Exit Hamlet]

In SPL, the built in parser which is downloaded with the program follows very specific rules as to what can happen in the script. One of such rules is that only two characters can be on stage at once. Also, making a character exit the stage who was never on stage will confuse it. The same goes for adding a character to the stage who is already on stage. When the parser receives an error, it will refuse to do ANYTHING else; you literally have to completely shutdown the program and the parser and then start up everything again.

P.S. If you have no idea how this language works, Google it. It's awesome.

  • 1
    \$\begingroup\$ So, is it a parse error or a runtime error? \$\endgroup\$ – Fabian Schmengler Oct 22 '15 at 13:30
  • 4
    \$\begingroup\$ @fschmengler That is basically the same thing for interpreted languages. \$\endgroup\$ – nwp Oct 23 '15 at 11:55
  • 13
    \$\begingroup\$ If I add code after the last line, will it actually execute though? \$\endgroup\$ – Sp3000 Oct 23 '15 at 12:48
  • \$\begingroup\$ @Sp3000 It will certainly try......it will appear as though nothing out of the ordinary has happened...until the parser crashes. :) \$\endgroup\$ – 3.14ed_Piper Nov 2 '15 at 14:16


I'm not sure if this qualifies:

Smalltalk := Nil.

This deletes the entire run-time environment, hanging the object engine. The only way to fix this is to forcibly terminate the process and restart from backup.

For those that don't know, the way [Visual Works] Smalltalk works is slightly weird. It's like a mini-OS. When you start Smalltalk, you load a "memory image" into RAM, and it continues executing from where it left off. The entire Smalltalk IDE is written in Smalltalk and is dynamically modifiable.

In particular, Smalltalk is a dictionary containing all global variables. Most particularly, every time you declare a new class, a global variable with that name is created, pointing to the Class object for your new class. So setting Smalltalk to Nil (basically null) deletes all classes in the entire system. Even the GUI event handlers go poof.

I have no idea why this variable is even writable. Probably because it's a global variable, and therefore exists as an entry inside itself. (Does your head hurt yet? Did I mention that every object has a class, and classes are objects, so every class has a class? The class of a class is called a metaclass, but a metaclass is also an object, which therefore has a class...)

You could probably achieve a similar effect by clearing the dictionary rather than replacing it with null. Indeed, there's any number of things you could code to delete all the classes in the system, leaving you unable to do anything. But since the actual Smalltalk compiler is also a class... anything that breaks the language also kinda breaks the entire IDE, so...

  • \$\begingroup\$ It is invalid if it hangs itself, but not the next command. But I'm curious: Does it have a class that can have both values being a class and being an ordinary object? And a class that can have both of those values and this new class? And a class of itself? \$\endgroup\$ – jimmy23013 Oct 20 '15 at 11:19
  • \$\begingroup\$ A Smalltalk class is vaguely like a JavaScript prototype. By hacking the system classes hard enough, you can even turn Smalltalk into a multiple-inheritance language. Also, method calls are objects, code blocks are objects... you can intercept undefined method calls and make them do stuff... it's a very dynamic language. Everything is an object! Including the IDE... \$\endgroup\$ – MathematicalOrchid Oct 20 '15 at 11:28
  • 1
    \$\begingroup\$ Had to use nil instead of Nil in Pharo. \$\endgroup\$ – mgarciaisaia Oct 20 '15 at 17:40
  • 5
    \$\begingroup\$ Another one is true become: false, but I think this doesn't work in newer versions of the language. You could kill SmallTalk/V 286 this way. \$\endgroup\$ – user15259 Oct 20 '15 at 18:13
  • 16
    \$\begingroup\$ “Did I mention that every object has a class, and classes are objects, so every class has a class? The class of a class is called a metaclass, but a metaclass is also an object, which therefore has a class...” As a Pythonista, my head doesn't hurt at all. On the contrary, I think I'd feel right at home with Smalltalk. \$\endgroup\$ – Blacklight Shining Oct 21 '15 at 19:24


There are a couple of possibilities here.

Boring idea #1: Define main to do nothing. Now no matter what other code you write, it can never execute. (Unless you manually run it from the REPL.)

Boring idea #2: Define a module with no public exports. Now no matter what other code your write, it can never execute.

Interesting idea: Disable all imports.

module Fubar where
import Prelude ()
foo = foo
-- More code here.

Now you can define functions which are visible and can be run... but they can't do anything. All standard Haskell types and functions are now hidden. (With the exception of a few things really deeply hard-wired into the language.)

Most particularly, you cannot perform any I/O whatsoever. You also cannot do machine-precision arithmetic. (Since Int, Double, etc are now undefined.)

You can still write lambda-calculus functions that do perform some real computation though. You just can't get any data into or out of the thing. But you could of course write another, separate module that calls the Fubar module above and does I/O on its behalf (thus proving that the code does execute and does do stuff).

Some subtleties:

  • The dummy foo = foo declaration is needed to prevent anybody adding additional imports. (Imports cannot appear after declarations.)

  • There are various non-standard Haskell language extensions that would enable you to climb out of this situation. But language extensions have to be switched on with a compiler pragma at the top of the file. (Or with a command-line switch to the compiler. I can't really prevent that one!)

  • \$\begingroup\$ -0.1 Use foobar, the spelling you used has some... unintended connotations. \$\endgroup\$ – wizzwizz4 Dec 12 '15 at 9:27
  • \$\begingroup\$ @wizzwizz4 I'm pretty sure "foobar" is just "fubar" prettied up to avoid censors. That's why I tend to avoid it in programming examples. \$\endgroup\$ – jpmc26 Feb 15 '16 at 7:17
  • 4
    \$\begingroup\$ @jpmc26 It actually has a long and distinguished history, going through an MIT model trains group, being popularised in a programming book before being incorporated into documentation, then being brought into popular culture. I'm pretty sure it's a coincidence. \$\endgroup\$ – wizzwizz4 Feb 15 '16 at 9:04
  • \$\begingroup\$ Both "boring ideas" are invalid because the user code isn't actually executed. (The "interesting idea" seems to be valid, though) \$\endgroup\$ – pppery Aug 31 at 17:43


Yes, PostScript is a programming language. Moreover, it's a programming language where all language constructs are system-defined functions, which can be redefined...

1000 dict /Magic def
systemdict {pop Magic exch {} put} forall
Magic begin

In English:

  • Create an empty 1,000-element dictionary and name it Magic.
  • For every key in systemdict, add the same key to Magic, with an empty definition ("{}").
  • Push Magic onto the top of the dictionary stack.

From this moment on, every PostScript language command is defined to do nothing. AFAIK, it is impossible to escape from this condition.

(Technically, you're not "destroying" the old definitions, you're just shadowing them. If you could still execute end, that would pop Magic off the dictionary stack, un-shadowing all the commands and giving you your life back. But since end itself is also shadowed... it will do nothing now.)

Note that all commands will still execute... it's just that now they are defined to do nothing. You won't get any kind of error, it's just that nothing will happen. (Well, I suppose stack overflow will happen eventually...)

  • \$\begingroup\$ This is actually kinda funny... and also scary... \$\endgroup\$ – Gryphon - Reinstate Monica Jul 10 '17 at 23:45

Any program executing under Linux/x86(-64)

This program is written in C, but it can disrupt execution of any program running under Linux/x86 (-32 or -64). You prepend it to the command-line invocation of the program you want to disrupt.

It uses the debugger API to prevent the target program from producing any output. Specifically, all of the system calls that can communicate something to the world outside the process (most obviously write, of course, but also open when creating a file, the bulk of the socket API, kill when applied to another process, ...) will fail as if they were unimplemented. _exit is allowed, but the exit code is overwritten with a zero.

Unlike the previous edition of this answer, many programs can run nearly to completion under these conditions; it's just that all their work is wasted. For instance, if you do ./no-syscalls /bin/ls (assuming GNU coreutils ls) it reads the whole directory and formats it, and then all the write calls to produce output fail. (Anything that needs to open a bidirectional communication channel, though, such as all X11 clients, will fail at that point. I thought about allowing socket but not send, but it seemed too likely to open loopholes.)

There are several command-line options to tweak the behavior;

-a  log allowed system calls
-d  log denied system calls
-e  deny everything, not just output
-S  permit writes to stderr

Dynamically linked programs will not even get out of the dynamic linker in -e mode. -S obviously opens a huge hole in the policy, but it can be entertaining to watch programs moan about nothing working, e.g.

$ ./no-syscalls -daeS /bin/ls
syscall 59...
syscall 59 = 0
syscall 12 (denied) = -38
syscall 21 (denied) = -38
syscall 9 (denied) = -38
syscall 20...
/bin/ls: error while loading shared libraries: cannot create cache for search path: Cannot allocate memory
syscall 20 = 107
syscall 231...
Program exited, status = 0

You have to read log output with /usr/include/asm*/unistd.h open in another window, because this is already quite long enough.

Sadly, the debugger interfaces that this uses are only weakly consistent across Unix implementations, and are intrinsically CPU-specific. It would be relatively straightforward to port it to other CPU architectures (just add appropriate definitions of SYSCALL_*_REG), and it's probably possible to port it to any Unix that has ptrace, but you might need to muck with the syscall whitelist extensively as well as dealing with divergences in ptrace.

#define _GNU_SOURCE 1
#include <stddef.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#if defined __linux__
# define SYS_unimplemented -1L
# if defined __i386__
#  define SYSCALL_NUMBER_REG regs.orig_eax
#  define SYSCALL_ARG1_REG   regs.ebx
#  define SYSCALL_ARG2_REG   regs.ecx
#  define SYSCALL_ARG3_REG   regs.edx
#  define SYSCALL_ARG4_REG   regs.esi
#  define SYSCALL_RESULT_REG regs.eax
# elif defined __x86_64__
#  define SYSCALL_NUMBER_REG regs.orig_rax
#  define SYSCALL_ARG1_REG   regs.rdi
#  define SYSCALL_ARG2_REG   regs.rsi
#  define SYSCALL_ARG3_REG   regs.rdx
#  define SYSCALL_ARG4_REG   regs.r10
#  define SYSCALL_RESULT_REG regs.rax
# else
#  error "Need to know system call convention for this CPU"
# endif
# error "Need to know system call convention for this OS"

static long
xptrace(int request, pid_t pid, void *addr, void *data)
  errno = 0;
  long rv = ptrace(request, pid, addr, data);
  if (rv == -1 && errno) {
    if (pid != 0) kill(pid, SIGKILL);
  return rv;
#define GET_REG_(pid, x) \
  xptrace(PTRACE_PEEKUSER, pid, (void*)offsetof(struct user, x), 0)
#define GET_REG(pid, x) GET_REG_(pid, SYSCALL_##x##_REG)
#define SET_REG_(pid, x, v) \
  xptrace(PTRACE_POKEUSER, pid, (void*)offsetof(struct user, x), (void*)v)
#define SET_REG(pid, x, v) SET_REG_(pid, SYSCALL_##x##_REG, v)

/* This function defines the system-call policy.  */
static int
deny_syscall(pid_t pid, int scnum, int deny_all, int allow_stderr)
  switch (scnum) {
  /* These syscalls are unconditionally allowed (when not in -e mode);
     they perform input, or change only process-local state. */
#ifdef SYS_access
  case SYS_access:
#ifdef SYS_alarm
  case SYS_alarm:
#ifdef SYS_arch_prctl
  case SYS_arch_prctl:
#ifdef SYS_brk
  case SYS_brk:
#ifdef SYS_capget
  case SYS_capget:
#ifdef SYS_clock_getres
  case SYS_clock_getres:
#ifdef SYS_clock_gettime
  case SYS_clock_gettime:
#ifdef SYS_clock_nanosleep
  case SYS_clock_nanosleep:
#ifdef SYS_close
  case SYS_close:
#ifdef SYS_dup
  case SYS_dup:
#ifdef SYS_dup2
  case SYS_dup2:
#ifdef SYS_dup3
  case SYS_dup3:
#ifdef SYS_epoll_create
  case SYS_epoll_create:
#ifdef SYS_epoll_create1
  case SYS_epoll_create1:
#ifdef SYS_epoll_ctl
  case SYS_epoll_ctl:
#ifdef SYS_epoll_ctl_old
  case SYS_epoll_ctl_old:
#ifdef SYS_epoll_pwait
  case SYS_epoll_pwait:
#ifdef SYS_epoll_wait
  case SYS_epoll_wait:
#ifdef SYS_epoll_wait_old
  case SYS_epoll_wait_old:
#ifdef SYS_eventfd
  case SYS_eventfd:
#ifdef SYS_eventfd2
  case SYS_eventfd2:
#ifdef SYS_faccessat
  case SYS_faccessat:
#ifdef SYS_fadvise64
  case SYS_fadvise64:
#ifdef SYS_fadvise64_64
  case SYS_fadvise64_64:
#ifdef SYS_fanotify_init
  case SYS_fanotify_init:
#ifdef SYS_fanotify_mark
  case SYS_fanotify_mark:
#ifdef SYS_fgetxattr
  case SYS_fgetxattr:
#ifdef SYS_flistxattr
  case SYS_flistxattr:
#ifdef SYS_fstat
  case SYS_fstat:
#ifdef SYS_fstat64
  case SYS_fstat64:
#ifdef SYS_fstatat64
  case SYS_fstatat64:
#ifdef SYS_fstatfs
  case SYS_fstatfs:
#ifdef SYS_fstatfs64
  case SYS_fstatfs64:
#ifdef SYS_ftime
  case SYS_ftime:
#ifdef SYS_futex
  case SYS_futex:
#ifdef SYS_getcpu
  case SYS_getcpu:
#ifdef SYS_getcwd
  case SYS_getcwd:
#ifdef SYS_getdents
  case SYS_getdents:
#ifdef SYS_getdents64
  case SYS_getdents64:
#ifdef SYS_getegid
  case SYS_getegid:
#ifdef SYS_getegid32
  case SYS_getegid32:
#ifdef SYS_geteuid
  case SYS_geteuid:
#ifdef SYS_geteuid32
  case SYS_geteuid32:
#ifdef SYS_getgid
  case SYS_getgid:
#ifdef SYS_getgid32
  case SYS_getgid32:
#ifdef SYS_getgroups
  case SYS_getgroups:
#ifdef SYS_getgroups32
  case SYS_getgroups32:
#ifdef SYS_getitimer
  case SYS_getitimer:
#ifdef SYS_get_kernel_syms
  case SYS_get_kernel_syms:
#ifdef SYS_get_mempolicy
  case SYS_get_mempolicy:
#ifdef SYS_getpeername
  case SYS_getpeername:
#ifdef SYS_getpgid
  case SYS_getpgid:
#ifdef SYS_getpgrp
  case SYS_getpgrp:
#ifdef SYS_getpid
  case SYS_getpid:
#ifdef SYS_getpmsg
  case SYS_getpmsg:
#ifdef SYS_getppid
  case SYS_getppid:
#ifdef SYS_getpriority
  case SYS_getpriority:
#ifdef SYS_getrandom
  case SYS_getrandom:
#ifdef SYS_getresgid
  case SYS_getresgid:
#ifdef SYS_getresgid32
  case SYS_getresgid32:
#ifdef SYS_getresuid
  case SYS_getresuid:
#ifdef SYS_getresuid32
  case SYS_getresuid32:
#ifdef SYS_getrlimit
  case SYS_getrlimit:
#ifdef SYS_get_robust_list
  case SYS_get_robust_list:
#ifdef SYS_getrusage
  case SYS_getrusage:
#ifdef SYS_getsid
  case SYS_getsid:
#ifdef SYS_getsockname
  case SYS_getsockname:
#ifdef SYS_getsockopt
  case SYS_getsockopt:
#ifdef SYS_get_thread_area
  case SYS_get_thread_area:
#ifdef SYS_gettid
  case SYS_gettid:
#ifdef SYS_gettimeofday
  case SYS_gettimeofday:
#ifdef SYS_getuid
  case SYS_getuid:
#ifdef SYS_getuid32
  case SYS_getuid32:
#ifdef SYS_getxattr
  case SYS_getxattr:
#ifdef SYS_inotify_add_watch
  case SYS_inotify_add_watch:
#ifdef SYS_inotify_init
  case SYS_inotify_init:
#ifdef SYS_inotify_init1
  case SYS_inotify_init1:
#ifdef SYS_inotify_rm_watch
  case SYS_inotify_rm_watch:
#ifdef SYS_ioprio_get
  case SYS_ioprio_get:
#ifdef SYS_kcmp
  case SYS_kcmp:
#ifdef SYS_lgetxattr
  case SYS_lgetxattr:
#ifdef SYS_listxattr
  case SYS_listxattr:
#ifdef SYS_llistxattr
  case SYS_llistxattr:
#ifdef SYS_lookup_dcookie
  case SYS_lookup_dcookie:
#ifdef SYS_lseek
  case SYS_lseek:
#ifdef SYS_lstat
  case SYS_lstat:
#ifdef SYS_lstat64
  case SYS_lstat64:
#ifdef SYS_madvise
  case SYS_madvise:
#ifdef SYS_mbind
  case SYS_mbind:
#ifdef SYS_mincore
  case SYS_mincore:
#ifdef SYS_mlock
  case SYS_mlock:
#ifdef SYS_mlockall
  case SYS_mlockall:
#ifdef SYS_mprotect
  case SYS_mprotect:
#ifdef SYS_mremap
  case SYS_mremap:
#ifdef SYS_munlock
  case SYS_munlock:
#ifdef SYS_munlockall
  case SYS_munlockall:
#ifdef SYS_munmap
  case SYS_munmap:
#ifdef SYS_name_to_handle_at
  case SYS_name_to_handle_at:
#ifdef SYS_nanosleep
  case SYS_nanosleep:
#ifdef SYS_newfstatat
  case SYS_newfstatat:
#ifdef SYS_nice
  case SYS_nice:
#ifdef SYS_oldfstat
  case SYS_oldfstat:
#ifdef SYS_oldlstat
  case SYS_oldlstat:
#ifdef SYS_oldolduname
  case SYS_oldolduname:
#ifdef SYS_oldstat
  case SYS_oldstat:
#ifdef SYS_olduname
  case SYS_olduname:
#ifdef SYS_pause
  case SYS_pause:
#ifdef SYS_perf_event_open
  case SYS_perf_event_open:
#ifdef SYS_personality
  case SYS_personality:
#ifdef SYS_pivot_root
  case SYS_pivot_root:
#ifdef SYS_poll
  case SYS_poll:
#ifdef SYS_ppoll
  case SYS_ppoll:
#ifdef SYS_prctl
  case SYS_prctl:
#ifdef SYS_pread64
  case SYS_pread64:
#ifdef SYS_preadv
  case SYS_preadv:
#ifdef SYS_prlimit64
  case SYS_prlimit64:
#ifdef SYS_pselect6
  case SYS_pselect6:
#ifdef SYS_query_module
  case SYS_query_module:
#ifdef SYS_read
  case SYS_read:
#ifdef SYS_readahead
  case SYS_readahead:
#ifdef SYS_readdir
  case SYS_readdir:
#ifdef SYS_readlink
  case SYS_readlink:
#ifdef SYS_readlinkat
  case SYS_readlinkat:
#ifdef SYS_readv
  case SYS_readv:
#ifdef SYS_recvfrom
  case SYS_recvfrom:
#ifdef SYS_recvmmsg
  case SYS_recvmmsg:
#ifdef SYS_recvmsg
  case SYS_recvmsg:
#ifdef SYS_remap_file_pages
  case SYS_remap_file_pages:
#ifdef SYS_request_key
  case SYS_request_key:
#ifdef SYS_restart_syscall
  case SYS_restart_syscall:
#ifdef SYS_rt_sigaction
  case SYS_rt_sigaction:
#ifdef SYS_rt_sigpending
  case SYS_rt_sigpending:
#ifdef SYS_rt_sigprocmask
  case SYS_rt_sigprocmask:
#ifdef SYS_rt_sigreturn
  case SYS_rt_sigreturn:
#ifdef SYS_rt_sigsuspend
  case SYS_rt_sigsuspend:
#ifdef SYS_rt_sigtimedwait
  case SYS_rt_sigtimedwait:
#ifdef SYS_sched_getaffinity
  case SYS_sched_getaffinity:
#ifdef SYS_sched_getattr
  case SYS_sched_getattr:
#ifdef SYS_sched_getparam
  case SYS_sched_getparam:
#ifdef SYS_sched_get_priority_max
  case SYS_sched_get_priority_max:
#ifdef SYS_sched_get_priority_min
  case SYS_sched_get_priority_min:
#ifdef SYS_sched_getscheduler
  case SYS_sched_getscheduler:
#ifdef SYS_sched_rr_get_interval
  case SYS_sched_rr_get_interval:
#ifdef SYS_sched_setaffinity
  case SYS_sched_setaffinity:
#ifdef SYS_sched_setattr
  case SYS_sched_setattr:
#ifdef SYS_sched_setparam
  case SYS_sched_setparam:
#ifdef SYS_sched_setscheduler
  case SYS_sched_setscheduler:
#ifdef SYS_sched_yield
  case SYS_sched_yield:
#ifdef SYS_select
  case SYS_select:
#ifdef SYS_setfsgid
  case SYS_setfsgid:
#ifdef SYS_setfsgid32
  case SYS_setfsgid32:
#ifdef SYS_setfsuid
  case SYS_setfsuid:
#ifdef SYS_setfsuid32
  case SYS_setfsuid32:
#ifdef SYS_setgid
  case SYS_setgid:
#ifdef SYS_setgid32
  case SYS_setgid32:
#ifdef SYS_setgroups
  case SYS_setgroups:
#ifdef SYS_setgroups32
  case SYS_setgroups32:
#ifdef SYS_setitimer
  case SYS_setitimer:
#ifdef SYS_setns
  case SYS_setns:
#ifdef SYS_setpgid
  case SYS_setpgid:
#ifdef SYS_setpriority
  case SYS_setpriority:
#ifdef SYS_setregid
  case SYS_setregid:
#ifdef SYS_setregid32
  case SYS_setregid32:
#ifdef SYS_setresgid
  case SYS_setresgid:
#ifdef SYS_setresgid32
  case SYS_setresgid32:
#ifdef SYS_setresuid
  case SYS_setresuid:
#ifdef SYS_setresuid32
  case SYS_setresuid32:
#ifdef SYS_setreuid
  case SYS_setreuid:
#ifdef SYS_setreuid32
  case SYS_setreuid32:
#ifdef SYS_setrlimit
  case SYS_setrlimit:
#ifdef SYS_set_robust_list
  case SYS_set_robust_list:
#ifdef SYS_setsid
  case SYS_setsid:
#ifdef SYS_set_thread_area
  case SYS_set_thread_area:
#ifdef SYS_set_tid_address
  case SYS_set_tid_address:
#ifdef SYS_setuid
  case SYS_setuid:
#ifdef SYS_setuid32
  case SYS_setuid32:
#ifdef SYS_sigaction
  case SYS_sigaction:
#ifdef SYS_sigaltstack
  case SYS_sigaltstack:
#ifdef SYS_signal
  case SYS_signal:
#ifdef SYS_signalfd
  case SYS_signalfd:
#ifdef SYS_signalfd4
  case SYS_signalfd4:
#ifdef SYS_sigpending
  case SYS_sigpending:
#ifdef SYS_sigprocmask
  case SYS_sigprocmask:
#ifdef SYS_sigreturn
  case SYS_sigreturn:
#ifdef SYS_sigsuspend
  case SYS_sigsuspend:
#ifdef SYS_socketpair
  case SYS_socketpair:
#ifdef SYS_stat
  case SYS_stat:
#ifdef SYS_stat64
  case SYS_stat64:
#ifdef SYS_statfs
  case SYS_statfs:
#ifdef SYS_statfs64
  case SYS_statfs64:
#ifdef SYS_sysfs
  case SYS_sysfs:
#ifdef SYS_sysinfo
  case SYS_sysinfo:
#ifdef SYS_time
  case SYS_time:
#ifdef SYS_timer_create
  case SYS_timer_create:
#ifdef SYS_timer_delete
  case SYS_timer_delete:
#ifdef SYS_timerfd_create
  case SYS_timerfd_create:
#ifdef SYS_timerfd_gettime
  case SYS_timerfd_gettime:
#ifdef SYS_timerfd_settime
  case SYS_timerfd_settime:
#ifdef SYS_timer_getoverrun
  case SYS_timer_getoverrun:
#ifdef SYS_timer_gettime
  case SYS_timer_gettime:
#ifdef SYS_timer_settime
  case SYS_timer_settime:
#ifdef SYS_times
  case SYS_times:
#ifdef SYS_ugetrlimit
  case SYS_ugetrlimit:
#ifdef SYS_ulimit
  case SYS_ulimit:
#ifdef SYS_umask
  case SYS_umask:
#ifdef SYS_uname
  case SYS_uname:
#ifdef SYS_unshare
  case SYS_unshare:
#ifdef SYS_uselib
  case SYS_uselib:
#ifdef SYS_ustat
  case SYS_ustat:
#ifdef SYS_wait4
  case SYS_wait4:
#ifdef SYS_waitid
  case SYS_waitid:
#ifdef SYS_waitpid
  case SYS_waitpid:
    return deny_all;

#ifdef SYS_exit
  case SYS_exit:
#ifdef SYS_exit_group
  case SYS_exit_group:
    /* Special case: exiting is allowed, even in -e mode,
       but the exit status is forced to 0. */
    SET_REG(pid, ARG1, 0);
    return 0;

#ifdef SYS_fcntl
  case SYS_fcntl:
#ifdef SYS_fcntl64
  case SYS_fcntl64:
    /* Special case: fcntl is allowed, but only for the *FD and *FL
       operations.  This is a compromise between not allowing it at
       all, which would break some interpreters, and trying to go
       through the dozens of extended ops and figure out which ones
       can affect global state.  */
      int cmd = GET_REG(pid, ARG2);
      if (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC ||
          cmd == F_GETFD || cmd == F_SETFD || cmd == F_SETFL || cmd == F_GETFL)
        return deny_all;
    return 1;

#ifdef SYS_kill
  case SYS_kill:
#ifdef SYS_rt_sigqueueinfo
  case SYS_rt_sigqueueinfo:
#ifdef SYS_rt_tgsigqueueinfo
  case SYS_rt_tgsigqueueinfo:
#ifdef SYS_tkill
  case SYS_tkill:
#ifdef SYS_tgkill
  case SYS_tgkill:
    /* Special case: kill is allowed if and only if directed to the calling
       process. */
      pid_t kpid = GET_REG(pid, ARG1);
      if (kpid == pid)
        return deny_all;
    return 1;

#ifdef SYS_mmap
  case SYS_mmap:
#ifdef SYS_mmap2
  case SYS_mmap2:
    /* Special case: mmap is allowed if it is private or read-only.  */
      int prot  = GET_REG(pid, ARG3);
      int flags = GET_REG(pid, ARG4);
      if ((flags & (MAP_SHARED|MAP_PRIVATE)) == MAP_PRIVATE)
        return deny_all;
      if (!(prot & PROT_WRITE))
        return deny_all;
    return 1;

    /* Special case: open() variants are allowed only if read-only and
       not creating. */
#ifdef SYS_open
  case SYS_open:
#ifdef SYS_openat
  case SYS_openat:
#ifdef SYS_open_by_handle_at
  case SYS_open_by_handle_at:
      int flags = ((scnum == SYS_open)
                   ? GET_REG(pid, ARG2)
                   : GET_REG(pid, ARG3));
      if (!(flags & O_CREAT) && ((flags & O_ACCMODE) == O_RDONLY))
        return deny_all;
    return 1;

#ifdef SYS_write
  case SYS_write:
#ifdef SYS_write64
  case SYS_write64:
#ifdef SYS_writev
  case SYS_writev:
#ifdef SYS_pwrite
  case SYS_pwrite:
#ifdef SYS_pwrite64
  case SYS_pwrite64:
#ifdef SYS_pwritev
  case SYS_pwritev:
    /* Special case: optionally, the program is allowed to write to
       stderr.  This opens a gaping hole in the policy, but it can be
       quite entertaining to watch programs moan about how nothing works. */
    if (allow_stderr) {
      int fd = GET_REG(pid, ARG1);
      if (fd == 2)
        return 0;
    return 1;

    /* All other system calls are unconditionally denied. */
    return 1;

static void
usage(char *progname)
  fprintf(stderr, "usage: %s [-adeS] program args...\n", progname);
  fputs("\t-a  log allowed system calls\n"
        "\t-d  log denied system calls\n"
        "\t-e  deny everything, not just output\n"
        "\t-S  permit writes to stderr\n", stderr);

main(int argc, char **argv)
  pid_t pid;
  int   status;
  int   opt;
  long  last_syscall = SYS_unimplemented;
  int   last_allowed = 0;
  int   after_execve = 0;
  int   trace_active = 0;
  int   allow_stderr = 0;
  int   deny_all     = 0;
  int   log_allowed  = 0;
  int   log_denied   = 0;

  while ((opt = getopt(argc, argv, "+adeS")) != -1) {
    switch (opt) {
    case 'a': log_allowed  = 1; break;
    case 'd': log_denied   = 1; break;
    case 'e': deny_all     = 1; break;
    case 'S': allow_stderr = 1; break;
  if (optind == argc) {

  setvbuf(stdout, 0, _IOLBF, 0);
  setvbuf(stderr, 0, _IOLBF, 0);

  pid = fork();
  if (pid == -1) {

  } else if (pid == 0) {
    raise(SIGSTOP); /* synch with parent */
    execvp(argv[optind], argv+optind);

  /* If we get here, we are the parent. */
  for (;;) {
    pid_t rv = waitpid(pid, &status, WUNTRACED);
    if (rv != pid) {
      kill(pid, SIGKILL);
    if (!WIFSTOPPED(status)) {
      if (WIFEXITED(status))
        printf("Program exited, status = %d\n", WEXITSTATUS(status));
      else if (WIFSIGNALED(status))
        printf("Program killed by signal %d\n", WTERMSIG(status));
      else {
        printf("Un-decodable status %04x\n", status);
        kill(pid, SIGKILL); /* just in case */
    if (WSTOPSIG(status) == SIGSTOP && !trace_active) {
      /* This is the raise(SIGSTOP) on the child side of the fork. */
      trace_active = 1;
      xptrace(PTRACE_SEIZE, pid, 0, (void*)PTRACE_O_TRACESYSGOOD);
      xptrace(PTRACE_SYSCALL, pid, 0, 0);
    else if (WSTOPSIG(status) == (SIGTRAP|0x80)) {
      if (last_syscall == SYS_unimplemented) {
        last_syscall = GET_REG(pid, NUMBER);
        /* The child process is allowed to execute normally until an
           execve() succeeds.  */
        if (after_execve && deny_syscall(pid, last_syscall,
                                         deny_all, allow_stderr)) {
          last_allowed = 0;
          SET_REG(pid, NUMBER, SYS_unimplemented);
        } else {
          last_allowed = 1;
          if (log_allowed) {
            /* Log this now, we may not get another chance. */
            printf("syscall %ld...\n", last_syscall);
      } else {
        if (last_allowed ? log_allowed : log_denied) {
          long scret = GET_REG(pid, RESULT);
          printf("syscall %ld%s = %ld\n",
                 last_syscall, last_allowed ? "" : " (denied)", scret);
        if (last_allowed && (last_syscall == SYS_execve ||
                             last_syscall == SYS_execveat)) {
          long scret = GET_REG(pid, RESULT);
          if (scret == 0)
            after_execve = 1;
        last_syscall = SYS_unimplemented;
      xptrace(PTRACE_SYSCALL, pid, 0, 0);
    else if (WSTOPSIG(status) == SIGTRAP) {
      /* Swallow all SIGTRAPs, they are probably spurious debug events. */
      xptrace(PTRACE_SYSCALL, pid, 0, 0);
    } else {
      /* Allow all normal signals to proceed unmolested. */
      if (log_allowed) {
        printf("process received signal %d\n", WSTOPSIG(status));
      xptrace(PTRACE_SYSCALL, pid, 0, (void*)(uintptr_t)WSTOPSIG(status));
  • 1
    \$\begingroup\$ “the target can read its command-line arguments, perform pure computations, and produce an 8-bit exit status, but will not be able to allocate memory or do I/O”—I dunno, I think you still meet the four criteria. Integers can be interpreted from commandline arguments; the exit status can be leveraged for simple output; addition isn't hindered; and all you need for a primality test is the ability to do pure computations, a bit of stack space, and a loop. \$\endgroup\$ – Blacklight Shining Oct 21 '15 at 19:36
  • 1
    \$\begingroup\$ @BlacklightShining I think that this accomplishes such a huge restriction relative to normal behavior that it should be acceptable even though, as you say, you could still write a prime tester, but -DNO_EXIT mode is for people who feel as you do. No meaningful output is possible in that mode. \$\endgroup\$ – zwol Oct 21 '15 at 20:36
  • 1
    \$\begingroup\$ @BlacklightShining I thought about it some more and I rewrote the program basically from scratch. It's rather cleverer now what it does and (I hope) meets even the most stringent reading of the challenge. \$\endgroup\$ – zwol Oct 22 '15 at 21:36
  • 2
    \$\begingroup\$ @Joshua That's clever, and would be difficult to prevent using this approach (since the program is just modifying its own memory) but it's not currently on the list of "allowed output methods." \$\endgroup\$ – zwol Jan 24 '16 at 4:02
  • 7
    \$\begingroup\$ @JesseTG Are you familiar with strace? \$\endgroup\$ – zwol Oct 2 '16 at 13:14



I'm not sure this will actually work, but in theory this should break \ as escape character leaving you no way to fix it. Normally TeX can read and write files, now it can't write anything that depends on logic. Thus the language is now broken as defined by OP.

EDIT: Other kill commands taken from the comments (although both might violate the code-must-be-executed rule):

  • 3
    \$\begingroup\$ A better version: \def\fi{}\iffalse. I can't post answers on this because it requires at least 10 rep earned from this site, but this will not allow output anymore too. \$\endgroup\$ – user530873 Oct 26 '15 at 0:12
  • 1
    \$\begingroup\$ @smpl you can still redefine \fi to its original meaning, right? Thus the language is not broken beyond any repair. \$\endgroup\$ – Cephalopod Oct 26 '15 at 12:07
  • 1
    \$\begingroup\$ @Cephalopod \fi is a TeX primitive. And no you can't redefine anything at this point, \iffalse has been called. \$\endgroup\$ – user530873 Oct 26 '15 at 14:48
  • 1
    \$\begingroup\$ @smpl Hmm, I see. Very clever. \$\endgroup\$ – Cephalopod Oct 26 '15 at 19:23
  • 1
    \$\begingroup\$ +1. I just started teaching myself out of the TeXBook and when I realized \catcode13=9% would completely break the language (Everything after % is commented and newlines (ASCII char 13) are ignored, so the comment extends to infinity) I wanted to post it here. But you have a slightly longer command already in here. \$\endgroup\$ – Iwillnotexist Idonotexist Jan 23 '16 at 23:03


Break Scratch Image
The when [timer v] > (0) will run as soon as the code is initialised, which if you're in the editor is before you even start the code. The when I receive (join[][]) will cause an error to be thrown every time anything is broadcast, pausing code execution if you have Developer version of Flash. The break function will create clones, and trigger the broadcast error. Every single clone will last two seconds then delete itself, putting strain on the stack. And every clone will respond to the when [timer v] > (0), running the break subroutine and resetting the timer, which causes the timer code to be run again. Also, each clone will respond to every broadcast error as well, meaning the number of errors per evaluation of break is the number of clones squared. Did I forget to mention that the break function has run without screen refresh checked, causing the editor to freeze, jolt and lag, as well as the grabbing and allocating memory. And maxing out the CPU.

Any code added anywhere with this running will find itself unable to create clones (300 clone limit surpassed) as well as heating up and crashing the computer running it. And grabbing memory until there is no more to grab, leaving variables misbehaving.

And, after there's too much lag to trigger the when [timer v] > (0) block, it'll still be running break.

Thanks to @towerofnix for reminding me about the when I receive glitch I found a while back, and giving me the idea for run without screen refresh. If you liked this, here's the original: https://codegolf.stackexchange.com/a/61357/43394

  • \$\begingroup\$ +1 Also might be fun to run an atomic (run without screen refresh) block with stop this script in it :P \$\endgroup\$ – Florrie Oct 22 '15 at 21:31
  • \$\begingroup\$ How does that "when I receive glitch" work? \$\endgroup\$ – Scimonster Oct 30 '15 at 12:04
  • \$\begingroup\$ @Scimonster The when I receive hat block is only designed to take input from the drop-down list. The join[][] block returns a data type that the when I recieve block isn't designed to accept. Every time something is broadcast, all of the hat blocks check, and evaluate the return value of the block, throwing an incorrect type error. \$\endgroup\$ – wizzwizz4 Oct 30 '15 at 15:24
  • \$\begingroup\$ I see. Though you have to hack the JSON file to actually get the join block in there. \$\endgroup\$ – Scimonster Oct 31 '15 at 18:52
  • 1
    \$\begingroup\$ @ppperry It's dependent on a version of Flash that ignores errors - this does exist. Taken to its extreme, "for small enough n" could be used to say (n-1) works for positive n < 3, but as this is algorithm-based a good algorithm should be able to make n large enough to be able to shrug that argument off. I'm not sure whether a faster or slower machine would make it more usable. However, I agree that this solution can be worked around. It's not a cops-and-robbers, but well done anyway. \$\endgroup\$ – wizzwizz4 Aug 5 '17 at 17:41


I'm suprised that it actually works, but closing STDOUT and STDERR suppresses all output. To be sure that they will not be opened again, we open /dev/null three times to reassign the file descriptors 0, 1 and 2:


// insert program here

More on that: https://stackoverflow.com/questions/937627/how-to-redirect-stdout-to-a-file-in-php

  • \$\begingroup\$ There are other valid output forms, including writing to files and using the program's exit code. See the link in the relevant bullet point of the spec. \$\endgroup\$ – Martin Ender Oct 18 '15 at 13:54
  • 1
    \$\begingroup\$ What exactly is allowed and not was not obvious to me. In the tag wiki for example I found nothing about files and exit codes. But if they are allowed, I don't think I can turn this into a valid submission. \$\endgroup\$ – Fabian Schmengler Oct 18 '15 at 15:29
  • \$\begingroup\$ Edited the question to allow disabling only one output form. \$\endgroup\$ – jimmy23013 Oct 18 '15 at 15:42
  • 21
    \$\begingroup\$ @jimmy23013 what? That completely defeats the point of the question. \$\endgroup\$ – hobbs Oct 18 '15 at 21:25
  • 6
    \$\begingroup\$ @jimmy23013 If it's valid to just disable only one output form then for example suppressing the program's exit code (as Martin suggested) is all I need to do even though the language is completely useable without an exit code? \$\endgroup\$ – Jerry Jeremiah Oct 19 '15 at 18:38

Mathematica / Wolfram Language

Mathematica is an interpreted language in which command names are symbols that can be manipulated by the programmer. You can't delete built-in operators, but you can overload them or otherwise modify their function. The following scrambles the "With" command, which is needed for assignment to variables even internally. This change prevents the kernel from holding arguments unevaluated until the assignment is complete, and it kills the language quite dead.

ClearAttributes["With", HoldAll]

If this command is run in an interactive session or within a block of code, Mathematica will not even be able add 1+1 (the resulting error message is about a page long so I won't include it here).


DOS batch (prior to Windows 95 I believe)


Issued with no arguments, this disconnects the command line from the terminal. Any further attempts to read input or generate output don't do anything.

In case you wanted to know how to use CTTY correctly:

MODE COM1,8600,8,N,1

A slightly more powerful batch file could even answer the modem and connect whatever dialed in to CTTY.



Here's a pretty simple example that will crash your browser (and, in theory, your computer):

Instant crash

I left this running for about twenty seconds, then lost 2.65 GB of memory to Scratch. Only a moment later and 5 GB were gone.

I highly suggest you have a means to force quit either Adobe Flash or your web browser before running this!

I really wanted to make a cool answer like the clear(this) JS one but sadly Scratch doesn't have any ways to do that. Feel free to update this post (or make your own) if you DO find another way to make Scratch unusable though!

  • 2
    \$\begingroup\$ Where do you add the user code, and is it actually executed? \$\endgroup\$ – jimmy23013 Oct 22 '15 at 4:54
  • \$\begingroup\$ User code? Anywhere in the project, as long as this snippet is inserted. It is executed once 0.3 seconds after the initial run, and then every 0.3 seconds (except that it also constantly reruns a script with no end, making Scratch very slow). Is it okay if I update this post with a better, more powerful crasher? \$\endgroup\$ – Florrie Oct 22 '15 at 17:35
  • 5
    \$\begingroup\$ Somebody using Scratch... d:-D YAY!!! \$\endgroup\$ – wizzwizz4 Oct 22 '15 at 18:09
  • \$\begingroup\$ @towerofnix By the way, I've improved / radically modified / recreated this here: codegolf.stackexchange.com/a/61490/43394 Mine doesn't rely on Microphone being on. \$\endgroup\$ – wizzwizz4 Oct 22 '15 at 19:08
  • 1
    \$\begingroup\$ @wizzwizz4 Yes yours is much better than mine. please go vote his \$\endgroup\$ – Florrie Oct 22 '15 at 21:30

Common Lisp

(set-macro-character #\( (lambda (x y) ()))

I hope you didn't need those opening parentheses.

This is a reader macro that tells the Lisp Reader to replace each instance of ( with a call to (lambda (x y) ()), a function that takes two arguments and returns nothing. So, for example, it would read (foo) as foo), interpret foo as a variable and then throw an unmatched parenthesis error on 0.

  • 2
    \$\begingroup\$ Please also interpret ) as something breaky! That way, there will be fewer errors. \$\endgroup\$ – wizzwizz4 Jan 21 '16 at 16:53
  • 7
    \$\begingroup\$ I love this. "What does lisp rely on? One single character? It would be a shame if something... happened to it..." It's the same logic as redefining `\` in TeX. \$\endgroup\$ – felixphew Jan 24 '16 at 20:55



With a newline at the end

The thue language relies on defining rulesets and a ::= denotes the end of the ruleset. It is impossible to do ANYTHING in thue without defining rules that do it, so regardless of what you put after the ::=, nothing can happen.

Alternative answer


(and so on for the every character in all of Unicode including those before the A character and non-printable characters). This requires the command-line option -r.

  • \$\begingroup\$ I guess the text isn't grammatically the same thing as something satisfies the criteria (such as a ruleset). \$\endgroup\$ – jimmy23013 Oct 18 '15 at 15:26


The following piece of code makes the environment completely unusable1:

builtin = @(varargin)false; clear = @(varargin)false;
%// Insert code after this point

This overrides the builtin function and the clear function with new anonymous function handles that simply return false every time you try and call these functions. The builtin function ensures that if there are any custom functions you write in MATLAB that are the same name as those that are built-in to MATLAB (things like sum, max, min, etc.), you are able to call these unambiguously instead of the overloaded functions. Similarly, clear gives you the ability to clear all variables that are currently declared so you can start anew. By removing these capabilities, there is no way that you can use MATLAB unless you restart the program.

In MATLAB R2015a, I also get the following message:

enter image description here

The Workspace are the variables that are currently declared in the environment so that you can use them for later. This permanently disables the Workspace, so any variables you try and create will not be saved and hence no progress can be made when executing lines of code in MATLAB.

1: Credit goes to user Dev-iL who originally discovered the idea.

  • 2
    \$\begingroup\$ In R2014b you can do feval('clear') to fix it. Or: s=str2func('clear'); s(). \$\endgroup\$ – Stewie Griffin Nov 8 '15 at 16:50



The only operation in /// is repeated string substitution, like this: /pattern/replacement/.

This code removes every /, that way you can't use repeated string substitution, so basically everything you write after that will get printed (except for /s).

You can still use \s, but that won't help you much.

  • \$\begingroup\$ I've always wondered if it's possible to write a piece of /// code which is guaranteed to erase everything after itself, and thus halt without printing anything. It seems impossible, but I haven't thought of a proof that it's impossible. \$\endgroup\$ – Tanner Swett Jul 21 '17 at 19:47



The user's code can follow anywhere after this sequence, as long as these are the first three characters in the source.

The ' command (one-shot string mode) pushes the ASCII value of the ~ onto the stack (i.e. 126), and the h command then sets what is known as the Holistic Delta with that value. For those not familiar with Befunge-96, the Holistic Delta is an offset that is added to the value of every command byte that the interpreter encounters.

Once the delta is set to 126, the only valid command that can be generated is ~ (character input), via a null byte in the source. Anything other than a null byte would translate to a value greater than 126, and none of those values would be valid Befunge commands.

I think it's safe to say that this would make it ineligible to qualify as a programming language.



macro harmless:

And then, somewhere else in the project,


A simple macro with a harmless-sounding name, but an amazingly frustrating effect. The Boo compiler uses a multi-step pipeline that begins with parsing source into an AST and ends with code generation. (Generally. It can be reconfigured for various applications.) Every step in between performs various operations on the AST.

Partway through is the macro expansion stage, in which macros are executed in the context of the compiler. Remember the bit in the last paragraph, about the pipeline being reconfigurable? If, during macro expansion, you invoke a macro that clears the pipeline, no error will be displayed to the user, but all steps after macro expansion (including code generation) are no longer there. So you end up with something that looks like a successful compilation--no error messages displayed--but for some reason there's no binary produced! Guaranteed to drive even the best troubleshooters up the wall, if you hide the macro and the invocation well.

  • \$\begingroup\$ This answer is invalid, as the user code never gets executed. \$\endgroup\$ – pppery Oct 19 '15 at 20:11
  • \$\begingroup\$ @ppperry: Sure it does: the macro can be written as part of the user code, and it's executed inside of the compiler. \$\endgroup\$ – Mason Wheeler Oct 19 '15 at 20:13
  • \$\begingroup\$ You would have to define such a macro for a character of set of characters that needs to be typed in every single program or set of programs that makes boo fit the criteria. \$\endgroup\$ – pppery Oct 19 '15 at 20:18
  • \$\begingroup\$ @ppperry: yes, invoking the macro (anywhere in the code) is what causes the compiler to break, fulfilling the criteria. If you're trying to say something deeper than that, you'll have to be a bit more clear, because I don't see what the problem is. \$\endgroup\$ – Mason Wheeler Oct 19 '15 at 20:24
  • 2
    \$\begingroup\$ @slebetman: And when you have a REPL, or macros where user code is executed at compile time, the distinction between the two gets very blurry. \$\endgroup\$ – Mason Wheeler Oct 20 '15 at 10:00


NGN/APL allows redefining primitives, so redefining () all primitive functions to ("pass through": both ⊢3 and 2⊢3 gives 3) makes the language completely useless:


Try it here.

  • 1
    \$\begingroup\$ -1 for now, but this seems promising! Maybe if you redefined all the primitives… \$\endgroup\$ – Blacklight Shining Oct 21 '15 at 19:30
  • \$\begingroup\$ @BlacklightShining There you go. \$\endgroup\$ – Adám Oct 23 '15 at 14:10

Ruby (29 characters)

class Object;def send;end;end

As 'send' is used internally whenever a method is called within Ruby, and since all objects inherit from the Object class. This should stop any method being run.

Fun Fact: This is perfectly sound in theory. But it appears, for some reason, not to hobble the Ruby language. I have no idea why it's possible to run this code and then still use an open Ruby environment.

  • \$\begingroup\$ Actually this works in the Pry Ruby shell. \$\endgroup\$ – Félix Saparelli Oct 22 '15 at 21:41
  • \$\begingroup\$ Do you mean it works as in "this breaks it" or it works as in "it still works after this"? Only, I did mention the second being the case in plain old irb \$\endgroup\$ – AJFaraday Oct 22 '15 at 21:46
  • 1
    \$\begingroup\$ I mean it breaks Pry. It doesn't break IRB, and it doesn't break running in .rb files, but it does break Pry. \$\endgroup\$ – Félix Saparelli Oct 22 '15 at 21:50
  • \$\begingroup\$ Interesting. I'd guess there's some protection on the send method that isn't working in pry. \$\endgroup\$ – AJFaraday Oct 22 '15 at 21:52


foreach x [info commands] {if {$x!="rename"&&$x!="if"} {rename $x ""}}

This removes all keywords from the language except if and rename.

The above code would cause any new code to error out. So it's debatable if the new inserted code actually gets "executed". Below is a version that executes new code but does nothing because it changes all keywords (except if and proc) to a no-operation:

foreach x [info commands] {if {$x!="if"&&$x!="proc"} {
    proc $x args {}

Instead of deleting keywords this code replaces them with a function that does nothing.

(Note: I'm using "keywords" very loosely here because Tcl doesn't have keywords, only functions)

  • 1
    \$\begingroup\$ I think you can make it better by renaming if and rename after the loop. In the second version, you should also make proc an exception. \$\endgroup\$ – jimmy23013 Oct 20 '15 at 7:08
  • \$\begingroup\$ @jimmy23013 Hmm.. technically you should be right but that code snippet works with the current version of tcl even when proc appears in the list before puts. Technically the code should also work without rename but built-in commands seem to be protected otherwise. Not sure what's going on but the code is tested and works as advertised. \$\endgroup\$ – slebetman Oct 20 '15 at 7:24
  • \$\begingroup\$ @jimmy23013: OK. Code now works without needing to call rename. It was brainfart on my part - I forgot to exclude proc. \$\endgroup\$ – slebetman Oct 20 '15 at 7:27
  • \$\begingroup\$ I decided not to rename if because being able to do if alone is pretty much useless if you want to generate output. \$\endgroup\$ – slebetman Oct 20 '15 at 7:28
  • \$\begingroup\$ Of course you don't need to rename them. But this is not code-golf. I just thought renaming them may (or may not) make this answer looks better. \$\endgroup\$ – jimmy23013 Oct 20 '15 at 7:32


=<  ~
(your code)

Hoon is a odd. It's pretty much entirely unlike other programming languages, not only in syntax but in semantics. Unlike languages like Hexagony, though, it wasn't made to be purposely esoteric.

Hoon compiles to Nock, a minimal combinator based VM. Nock is stupid: the spec can be gzipped to 340 bytes. The only math operation is incrementing. Everything is a noun: an atom (bignum) or a cell (pair of nouns), with the entire memory model arranged in an immutable acyclic binary tree. The only output is the noun that your expression reduces to.

Because of the weird compilation target, Hoon is also weird: it's completely pure. Hoon compiles down to a Nock expression that is evaluated on a "context". The entire kernel and stdlib, along with all variables, are passed implicitly to the program by the context.

To make Hoon unusable we just use =<, which is "evaluate a in the context of b". We are always evaluating ~, which is zero. No matter what b does, it can't change the value it reduces to, and since it can't have side effect it can't do input or output.

Side note: Since you can't actually prompt for input from Hoon (purity!), by the rules it isn't actually a programming language. Input is via function arguments, output via return values (or ~&, which is more of a printf debugging feature and is transparent to the program).

For a program to get input in Urbit, you actually write a program that return a function that accepts input, and the shell asks on your behalf and passes to the callback.

  • 3
    \$\begingroup\$ Definitely a programming language by our standards, though \$\endgroup\$ – cat Oct 1 '16 at 10:41

Taxi, 2354 bytes.

This little program simply runs the taxi in a large joyride through Townsburg, running out of gas. Any code you run after this will quickly error with error: out of gas. And even if you could reach a gas station, which I don't think is possible, you couldn't get any gas, as no money has been collected, since there are no passengers.

Go to Trunkers: west, 1st right, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st left, 1st left, 1st right.

JavaScript in browser

Well, at least in IE11.

window.addEventListener("error", function(){});
document = document.write = alert = prompt = confirm = console = void(
    (function (window) {
        try {
            //Code goes here
        } catch (e) {}

Disables writing to the document, writing to the global variable and returning from the function.

Comment if I've missed out an output method!

  • \$\begingroup\$ Exceptions will still show in the console. You can handle those by doing window.addEventListener('error',function(){}); \$\endgroup\$ – Ismael Miguel Oct 18 '15 at 19:19
  • \$\begingroup\$ @IsmaelMiguel Now I can't take all the credit! d;-D \$\endgroup\$ – wizzwizz4 Oct 18 '15 at 19:24
  • 4
    \$\begingroup\$ Does this seriously work? That makes no sense at all: document should still be accessible from the outer scope in the inserted code, and it shouldn't get replaced until after the inserted code has finished executing. \$\endgroup\$ – Peter Taylor Oct 18 '15 at 20:46
  • \$\begingroup\$ @PeterTaylor :-( Your logic broke my theory. \$\endgroup\$ – wizzwizz4 Oct 19 '15 at 18:00
  • 2
    \$\begingroup\$ It's not easy \$\endgroup\$ – Peter Taylor Oct 19 '15 at 21:02

Python 2, insanely big

import rexec, ihooks, types, os, struct,sys,imp
from functools import update_wrapper as do_update, wraps
__all__ = ["RExec","enable"]
trashed = False
from ctypes import pythonapi, POINTER, py_object
getdict = pythonapi._PyObject_GetDictPtr
getdict.restype = POINTER(py_object)
getdict.argtypes = [py_object]
modified = ctypes.pythonapi.PyType_Modified
modified.argtypes = [ctypes.py_object]
def dictionary_of(ob):
    dptr = getdict(ob)
    if dptr and dptr.contents:
        return dptr.contents.value
class RExec(rexec.RExec):
    ok_sys_names = rexec.RExec.ok_sys_names + ("warnoptions","py3kwarning","flags")
    nok_sys_strings = ("executable",)
    ok_builtin_modules = rexec.RExec.ok_builtin_modules + ("cStringIO","exceptions","_collections","itertools","_hashlib","_codecs","_functools","_struct")
    def __init__(self, hooks = None, verbose = 0):
        ihooks._Verbose.__init__(self, verbose)
        self.hooks = hooks or rexec.RHooks(verbose)
        self.modules = {}
        self.ok_dynamic_modules = self.ok_builtin_modules
        list = []
        for mname in self.ok_builtin_modules:
            if mname in sys.builtin_module_names:
        self.ok_builtin_modules = tuple(list)
        self.loader = rexec.RModuleLoader(self.hooks, verbose)
        self.importer = rexec.RModuleImporter(self.loader, verbose)
    def make_sys(self):
        sys_ = self.modules["sys"]
        for name in dir(sys):
            obj = getattr(sys,name)
            if "__" not in name and type(obj) == str and \
              not hasattr(sys_,name):
                if name in self.nok_sys_strings:
                    obj = RESTRICTED
        sys_.argv = [RESTRICTED]
    def make_initial_modules(self):
        b = self.modules["__builtin__"]
        for module in self.modules.itervalues():
            module.__builtins__ = b
    def make_StringIO(self):
        t = type(self.r_open)
        if t == types.ClassType or t == type:
        elif t != types.FunctionType and t != types.MethodType:
            raise RuntimeError
        io = self.r_import("StringIO").StringIO
        old_open = self.r_open
        class r_open(io):
            def __init__(self,*openargs):
                o = old_open(*openargs)
                if o.isatty():raise IOError
            def __enter__(self):
                return self
            def __exit__(self,type,val,tb):
            for name in "truncate write flush".split():
                exec "def %s(self,arg=None):raise IOError('File not open for writing')" % name
            del name
        ntypes = self.modules["types"]
        b = self.modules["__builtin__"]
        ntypes.FileType = self.r_open = b.open = b.file = r_open
    def r_import(self,name,globals={},locals={},fromlist=[],level=-1):
        redone = name in self.modules
        found = False
            result = self.importer.import_module(name, globals, locals, fromlist,level)
        except ImportError:
            if name == "imp":
                result = imp.new_module("imp")
                found = True
            if not found:raise
        if redone:pass #Only do this once
        elif name == "sysconfig":
            result._PROJECT_BASE = "x"
            result._CONFIG_VARS = {}
        elif name == "functools":
            update = result.update_wrapper
            def update_wrapper(wrapper,wrapped,assigned=(),updated=()):
                return update(wrapper,wrapped,assigned,updated)
            result.update_wrapper = update_wrapper
            def wraps(wrapped,*args,**kw):
                return result.partial(update_wrapper,wrapped=wrapped,*args,**kw)
            result.wraps = wraps
        return result
    def s_apply(self,func,args=(),kw=None):
        kw = kw or {}
        if getattr(func,"__stdin_trashing",False):
            kw["s_applied"] = True
        return old_rexec.s_apply(self,func,args,kw)
    r_exc_info = staticmethod(sys.exc_info)
    def r_method(name):
        l = {}
        exec \
"""def %s(self,*args,**kwargs):
    s_applied = kwargs.pop("s_applied",False)
    if kwargs:raise TypeError
    if not s_applied:
        sys.stdin = sys.stdout = sys.stderr = None
    global restrictedly
    restrictedly = True
        return old_rexec.%s(self,*args)
        restrictedly = False
        if not s_applied:
setattr(%s,"__stdin_trashing",True)""" % (name,name,name) in globals(),l
        return l[name]
    r_exec = r_method("r_exec")
    r_eval = r_method("r_eval")
    del r_method
old_rexec = rexec.RExec
class ModuleImporter(ihooks.ModuleImporter):
    def determine_parent(self, globals, level=-1):
        if not globals or not level:return None
        pkgname = globals.get('__package__')
        if pkgname is not None:
            if not pkgname and level > 0:raise ValueError, 'Attempted relative import in non-package'
            modname = globals.get('__name__')
            if modname is None:return None
            if "__path__" in globals:pkgname = modname
                # normal module, work out package name if any
                if '.' not in modname:
                    if level > 0:raise ValueError, ('Attempted relative import in non-package')
                    globals['__package__'] = None
                    return None
                pkgname = modname.rpartition('.')[0]
            globals['__package__'] = pkgname
        if level > 0:
            dot = len(pkgname)
            for x in range(level, 1, -1):
                    dot = pkgname.rindex('.', 0, dot)
                except ValueError:raise ValueError('attempted relative import beyond top-level package')
            pkgname = pkgname[:dot]
            return self.modules[pkgname]
        except KeyError:
            if level < 1:
                warn("Parent module '%s' not found while handling "
                     "absolute import" % pkgname, RuntimeWarning, 1)
                return None
            else:raise SystemError, ("Parent module '%s' not loaded, cannot perform relative import" % pkgname)
restrictedly = False
def enable():
    rexec.RExec = RExec
    rexec.RModuleImporter = ModuleImporter
    global trashed
    if not trashed:
        subclasses = type.__subclasses__
        error = None
        def restrict(fun):
            error_ = error
            def censored(*args):
                global restrictedly
                if restrictedly:
                    if error_ is not None:
                        return error_
                    raise RuntimeError
                return fun(*args)
            return censored
        error = ()
        error = None
        #Stop uses of frames (created using with statements)
        old_frame = types.TracebackType.tb_frame
        def new_frame(self):
            return old_frame.__get__(self,types.TracebackType)
        def new_frame(self,v):
            raise TypeError("Readonly attribute")
        dictionary_of(types.TracebackType)["tb_frame"] = new_frame
        trashed = True
def test():
    r = RExec()
                """Your code goes here!"""
        return 0
if __name__ == "__main__":

This insanely large amount of code is a revival of the ancient rexec module (abandoned in python 2.3) with a bunch of new modules added to the "ok" list and a bunch of weaknesses fixed (including the object.__subclasses__() method that has made at least two other python answers invalid).

Quite a bit of this code (the __init__ method of the RExec class and the entire ModuleImporter class) is copied from the python standard library with small modifications.

  • 2
    \$\begingroup\$ 0.o wh...what have you done \$\endgroup\$ – cat Feb 22 '16 at 20:45
  • \$\begingroup\$ 8064 bytes by the way \$\endgroup\$ – cat Feb 22 '16 at 20:45
  • \$\begingroup\$ @cat not that this is code golf. I could probably golf out at least 1000 bytes. \$\endgroup\$ – pppery Feb 22 '16 at 20:46
  • \$\begingroup\$ of course, but you said "insanely big" so i thought i'd note it \$\endgroup\$ – cat Feb 22 '16 at 20:49

Your Answer

