@@ -16,6 +16,7 @@ type Python struct{}
1616
1717func (p Python) Open() {
1818 C.Py_Initialize()
19+ p.LoadModule("readline")
1920 p.Eval("import signal")
2021 p.Eval("signal.signal(signal.SIGINT, signal.default_int_handler)")
2122}
@@ -60,6 +61,12 @@ func (p Python) REPLLikeEval(code string) {
6061 C.pry_eval(ccode, C.Py_single_input)
6162}
6263
64+func (p Python) LoadModule(mod string) {
65+ cmode := C.CString(mod)
66+ defer C.free(unsafe.Pointer(cmode))
67+ C.PyImport_ImportModule(cmode)
68+}
69+
6370func (p Python) REPL() {
6471 C.pymain_run_interactive_hook()
6572