- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
Also, do y’all call main() in the if block or do you just put the code you want to run in the if block?
Also, do y’all call main() in the if block or do you just put the code you want to run in the if block?
Can you elaborate on this blood magic?
It simply swaps some things around to make things more confusing, then goes into an infinite loop (whether or not you import or execute it standalone). it’s no different than just including in the global scope:
while True: pass
I was kinda lazy with the fuckery, tbh. I could have gotten much more confusing, but don’t have too much time today. :-)
Maybe I should do a post in programmer humor about preventing arbitrary execution of your python code, and make it sound like it prevents security flaws. …which, technically, it does - if your code isn’t executing, and instead a useless infinite loop is executing, there’s nothing to exploit.