all: clean up everything

This commit is contained in:
2018-12-06 14:23:33 +01:00
parent c81487fa28
commit 54024171b1
4 changed files with 4 additions and 248 deletions

View File

@@ -22,22 +22,4 @@ else:
sys.ps1 = "2>>> "
sys.ps2 = "2... "
def hijack_prompt():
old_except = sys.excepthook
def new_except(type, value, traceback):
name_ = type is NameError and value.args[0] in ["name 'q' is not defined",
"name 'e' is not defined"]
syntax_ = type is SyntaxError and value.text in [":q\n", ":e\n"]
if name_ or syntax_:
print("Moriturus te saluto.")
exit()
old_except(type, value, traceback)
sys.excepthook = new_except
hijack_prompt()
del readline, histfile, atexit, write_history, sys, os, hijack_prompt
del readline, histfile, atexit, write_history, sys, os