Errors in C++

This commit is contained in:
Vítor Santos Costa
2018-05-22 21:33:34 +01:00
parent 9ea75834ff
commit 8607aee725
7 changed files with 161 additions and 181 deletions

View File

@@ -62,13 +62,11 @@ static void *py_open(VFS_t *me, const char *name, const char *io_mode,
st->user_name = TermOutStream;
} else if (strcmp(name, "sys.stderr") == 0) {
st->user_name = TermErrStream;
} else if (strcmp(name, "input") == 0) {
pystream = PyObject_Call(pystream, PyTuple_New(0), NULL);
} else {
st->user_name = YAP_MkAtomTerm(st->name);
}
// we assume object is already open, so there is no need to open it.
if (PyCallable_Check(pystream))
st->u.private_data = PyObject_Call(pystream, PyTuple_New(0), NULL);
else
st->u.private_data = pystream;
st->vfs = me;
python_release_GIL(ctk);

View File

@@ -69,10 +69,10 @@ nb_setval(jupyter_cell, false),
).
streams(true) :-
nb_setval(jupyter_cell, true),
open('/python/input', read, _Input, [alias(user_input),bom(false)]),
% open('/python/input', read, _Input, [alias(user_input),bom(false)]),
open('/python/sys.stdout', append, _Output, [alias(user_output)]),
open('/python/sys.stderr', append, _Error, [alias(user_error)]),
set_prolog_flag(user_input,_Input),
% set_prolog_flag(user_input,_Input),
set_prolog_flag(user_output,_Output),
set_prolog_flag(user_error,_Error).