"It compiled. Ship it."
OK, why the heck does this even exist?
This is a live collection of cursed Python code written by beginners, sleep-deprived developers, and people who thought "what if...?" one too many times.
This is not really a repository of bugs. Bugs get fixed. These somehow gets committed.
All contributions are judged by one standard: does it work, and is it horrifying? Both conditions must be true. Code that merely fails is not a war crime, it's just broken. Code that succeeds despite itself is what we're after.
Read Geneva_Convention.md for the full list of rules you are absolutely encouraged to violate.
| Folder | Crimes Against |
|---|---|
Variables/ |
Horrifying definitions, sanity -100 |
Functions/ |
Some Functions names that will haunt you |
Control_Flow/ |
YandereDev impersonations |
Classes/ |
Really badly made and used classes |
Exceptions/ |
try and except more like I don't care about bugs |
Imports/ |
Importing can be challenging at times, but this is way worse |
Unicode_Crimes/ |
See what happens if you mix different languages together |
Built-in_Abuse/ |
str, list, type, and God |
Black_Magic/ |
The reason for the existence of CPython implementations |
Production_Sightings/ |
These war crimes somehow appears in real applications |
You can definitely run each file they are all 100% safe:
python3 Functions/mutable_default_args.pyEach one has a docstring at the top explaining exactly why it shouldn't work. Before you run it read that first, then you may proceed, then sit with your feelings (WHAT HAVE YOU DONE???).
CI runs every exhibit on Python 3.11, 3.12, and 3.13.
If a file suddenly starts behaving normally, the build fails.
The only deliberate exception is:
Black_Magic/deface_small_int.py
That exhibit is supposed to crash...
depending on CPython's internal memory layout, outcome varies by build and platform (confirmed: it segfaults on some 3.12 builds and exits cleanly on others). Check scripts/verify_crimes.py for more info.
Wait? You want to contribute to this madness that is this repository? Well you are definitely welcome to do so. Here are some steps in being able to add your own Python War Crimes into this collection:
- Write code that breaks a rule in
Geneva_Convention.md. - Confirm it actually runs.
python3 your_crime.pymust exit0, or the crime doesn't count — it's just a bug. (If your crime is supposed to crash the interpreter, add it toEXPECTED_NONZEROinscripts/verify_crimes.pyand say why.) - Add a one-line docstring at the top explaining why this should not work.
- Open a PR using the template. Include the Python version you tested on — some of these are CPython implementation details and will not survive contact with PyPy, or even a newer CPython.
Please DO NOT use any code found in this repository and use it in production.
Several entries were found in production. That is the tragedy, not the endorsement. See Production_Sightings/ for details, names redacted to protect the guilty.
MIT. Do whatever you want with these. Frankly, someone should stop you, but it won't be this license, and I am not inventing my own.