jupyter
This commit is contained in:
parent
0c950ce5b3
commit
b4201dd0f3
@ -158,9 +158,9 @@ else if (PyDict_Check(pVal)) {
|
||||
Term t0[2], to;
|
||||
t0[0] = python_to_term__(key);
|
||||
t0[1] = python_to_term__(value);
|
||||
to = Yap_MkApplTerm(FunctorEq, 2, t0);
|
||||
to = Yap_MkApplTerm(FunctorModule, 2, t0);
|
||||
if (left--) {
|
||||
t = Yap_MkNewApplTerm(FunctorOr, 2);
|
||||
t = Yap_MkNewApplTerm(FunctorComma, 2);
|
||||
*opt = t;
|
||||
CELL *pt = RepAppl(t) + 1;
|
||||
pt[0] = to;
|
||||
|
@ -130,14 +130,15 @@ static bool py_close(int sno) {
|
||||
static bool getLine(StreamDesc *rl_iostream, int sno) {
|
||||
char *myrl_line = NULL;
|
||||
// term_t ctk = python_acquire_GIL();
|
||||
PyObject_Print(rl_iostream->u.private_data, stderr, 0);
|
||||
/* window of vulnerability opened */
|
||||
PyObject *readl =
|
||||
PyObject_GetAttrString(rl_iostream->u.private_data, "readline");
|
||||
PyObject_Print(readl, stderr, 0);
|
||||
PyObject *readl =
|
||||
PythonLookup("input", Py_None);
|
||||
PyObject_Print(readl, stderr, 0);fprintf(stderr," input\n");
|
||||
|
||||
myrl_line = PyUnicode_AsUTF8(
|
||||
PyObject_CallFunctionObjArgs(readl, rl_iostream->u.private_data, NULL));
|
||||
|
||||
PyObject *user_inp = PyObject_CallFunction(readl,NULL);
|
||||
PyObject_Print(user_inp, stderr, 0);fprintf(stderr," input\n");
|
||||
myrl_line = PyUnicode_AsUTF8(user_inp);
|
||||
//PyObject_Print(myrl_line, stderr, 0);fprintf(stderr," myrl_line\n");
|
||||
// python_release_GIL(ctk);
|
||||
PyObject *err;
|
||||
if ((err = PyErr_Occurred())) {
|
||||
|
@ -72,7 +72,7 @@ python_query( Caller, String ) :-
|
||||
atomic_to_term( String, Goal, VarNames ),
|
||||
query_to_answer( Goal, VarNames, Status, Bindings),
|
||||
atom_to_string( Status, SStatus ),
|
||||
Caller.port := SStatus,
|
||||
% Caller.port := SStatus,
|
||||
write_query_answer( Bindings ),
|
||||
nl(user_error),
|
||||
Caller.answer := {},
|
||||
|
@ -37,7 +37,8 @@ jupyter_cell( _Caller, _, `` ) :- !.
|
||||
jupyter_cell( _Caller, _, Line ) :-
|
||||
blank( Line ),
|
||||
!.
|
||||
jupyter_cell(Self, _, Line ) :-
|
||||
jupyter_cell(Caller, _, Line ) :-
|
||||
Self := Caller.query,
|
||||
catch(
|
||||
python_query(Self,Line),
|
||||
E=error(A,B),
|
||||
|
@ -519,6 +519,10 @@ class YAPRun:
|
||||
self.shell.yapeng = self.yapeng
|
||||
self._get_exc_info = shell._get_exc_info
|
||||
|
||||
|
||||
def showtraceback(self, tuple):
|
||||
return None
|
||||
|
||||
def syntaxErrors(self, text):
|
||||
"""Return whether a legal query
|
||||
"""
|
||||
|
Reference in New Issue
Block a user