1#include "pry_python3.h"
3int pry_eval_file(FILE *f, const char *file, int argn, const char *argv)
5 wchar_t *xargv[argn + 1];
6 const char *ptr = argv;
7 for (int i = 0; i < argn; ++i)
9 xargv[i] = Py_DecodeLocale(ptr, NULL);
10 ptr += strlen(ptr) + 1;
13 PySys_SetArgvEx(argn, xargv, 1);
15 return PyRun_AnyFile(f, file);
18const char *pry_eval(const char *code, int start)
21 PyObject *m, *d, *s, *t, *v;
23 m = PyImport_AddModule("__main__");
28 d = PyModule_GetDict(m);
29 c = Py_CompileString(code, "(eval)", start);
35 v = PyEval_EvalCode(c, d, d);
48 t = PyUnicode_AsUTF8String(s);
56 char *str = PyBytes_AsString(t);
63void pry_set_prompts(const char *ps1, const char *ps2)
65 PyObject *po1 = PyUnicode_FromString(ps1);
66 PyObject *po2 = PyUnicode_FromString(ps2);
67 PySys_SetObject("ps1", po1);
68 PySys_SetObject("ps2", po2);
73//From python3 sourcecode
75pymain_run_interactive_hook(int *exitcode)
77 PyObject *sys, *hook, *result;
78 sys = PyImport_ImportModule("sys");
83 hook = PyObject_GetAttrString(sys, "__interactivehook__");
90 if (PySys_Audit("cpython.run_interactivehook", "O", hook) < 0) {
94 result = _PyObject_CallNoArg(hook);
104 PySys_WriteStderr("Failed calling sys.__interactivehook__\n");
105 return pymain_err_print(exitcode);
109pymain_err_print(int *exitcode_p)
112 if (_Py_HandleSystemExit(&exitcode)) {
113 *exitcode_p = exitcode;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list