From 45439b8b86ff41b831dc628b69ed49fd0835b9fd Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 17 Oct 2018 16:51:29 +0100 Subject: [PATCH] fix backcall --- H/Yatom.h | 5 +++++ include/VFS.h | 1 + packages/python/setup.py | 2 +- packages/python/yap_kernel/backcall/__init__.py | 0 .../python/yap_kernel/yap_ipython/core/events.py | 2 +- packages/python/yap_kernel/yap_ipython/yapi.py | 1 - .../python/yap_kernel/yap_kernel/ipkernel.py | 16 ++++++++-------- 7 files changed, 16 insertions(+), 11 deletions(-) delete mode 100644 packages/python/yap_kernel/backcall/__init__.py diff --git a/H/Yatom.h b/H/Yatom.h index 91d23559c..78b96255b 100755 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -1529,6 +1529,11 @@ extern bool Yap_HasException(void); extern yap_error_descriptor_t *Yap_GetException(); extern void Yap_PrintException(yap_error_descriptor_t *i); INLINE_ONLY bool Yap_HasException(void) { + extern yap_error_number Yap_MathException__(USES_REGS1); + yap_error_number me; + if ((me = Yap_MathException__(PASS_REGS1)) && LOCAL_ActiveError->errorNo != YAP_NO_ERROR) { + LOCAL_ActiveError->errorNo = me; + } return LOCAL_ActiveError->errorNo != YAP_NO_ERROR; } diff --git a/include/VFS.h b/include/VFS.h index 81aea375d..624d5d6ce 100644 --- a/include/VFS.h +++ b/include/VFS.h @@ -85,6 +85,7 @@ typedef struct vfs { /// in this space, usual w,r,a,b flags plus B (store in a buffer) bool (*close)(int sno); /// close the object int (*get_char)(int sno); /// get an octet from the stream + int (*get_wchar)(int sno); /// get an octet from the stream int (*peek_char)(int sno); /// unget an octet from the stream int (*peek_wchar)(int sno); /// unget an octet from the stream int (*put_char)(int sno, int ch); /// output an octet to the stream diff --git a/packages/python/setup.py b/packages/python/setup.py index 5a3861bdd..b68d77794 100644 --- a/packages/python/setup.py +++ b/packages/python/setup.py @@ -7,7 +7,7 @@ from __future__ import print_function # the name of the package -name = 'ipykernel' +name = 'yap_kernel' #----------------------------------------------------------------------------- # Minimal Python version sanity check diff --git a/packages/python/yap_kernel/backcall/__init__.py b/packages/python/yap_kernel/backcall/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/python/yap_kernel/yap_ipython/core/events.py b/packages/python/yap_kernel/yap_ipython/core/events.py index 64d05e919..3431a5398 100644 --- a/packages/python/yap_kernel/yap_ipython/core/events.py +++ b/packages/python/yap_kernel/yap_ipython/core/events.py @@ -13,7 +13,7 @@ events and the arguments which will be passed to them. This API is experimental in yap_ipython 2.0, and may be revised in future versions. """ -from yap_ipython.core.backcall import callback_prototype +from backcall import callback_prototype class EventManager(object): diff --git a/packages/python/yap_kernel/yap_ipython/yapi.py b/packages/python/yap_kernel/yap_ipython/yapi.py index 5d0554644..c941990aa 100644 --- a/packages/python/yap_kernel/yap_ipython/yapi.py +++ b/packages/python/yap_kernel/yap_ipython/yapi.py @@ -727,7 +727,6 @@ class YAPRun: self.result.result = False has_raised = False try: - builtin_mod.input = self.shell.sys_raw_input self.yapeng.mgoal(streams(True),"user", True) if cell.strip('\n \t'): #create a Trace object, telling it what to ignore, and whether to diff --git a/packages/python/yap_kernel/yap_kernel/ipkernel.py b/packages/python/yap_kernel/yap_kernel/ipkernel.py index 0931beb72..9c4ff9a2b 100644 --- a/packages/python/yap_kernel/yap_kernel/ipkernel.py +++ b/packages/python/yap_kernel/yap_kernel/ipkernel.py @@ -166,14 +166,14 @@ class YAPKernel(KernelBase): """ self._allow_stdin = allow_stdin - # if PY3: - # self._sys_raw_input = builtin_mod.input - # builtin_mod.input = self.raw_input - # else: - # self._sys_raw_input = builtin_mod.raw_input - # self._sys_eval_input = builtin_mod.input - # builtin_mod.raw_input = self.raw_input - # builtin_mod.input = lambda prompt='': eval(self.raw_input(prompt)) + if PY3: + self._sys_raw_input = builtin_mod.input + builtin_mod.input = self.raw_input + else: + self._sys_raw_input = builtin_mod.raw_input + self._sys_eval_input = builtin_mod.input + builtin_mod.raw_input = self.raw_input + builtin_mod.input = lambda prompt='': eval(self._sys_input(prompt)) self._save_getpass = getpass.getpass getpass.getpass = self.getpass