diff --git a/idapython.cpp b/idapython.cpp index f3e21e8..db6ecb3 100644 --- a/idapython.cpp +++ b/idapython.cpp @@ -1491,6 +1491,9 @@ bool idapython_plugin_t::_extlang_eval_snippet( qstring *errbuf) { PYW_GIL_GET; +#ifdef TESTABLE_BUILD + QASSERT(0, PyErr_Occurred() == nullptr); +#endif PyObject *globals = _get_module_globals(); bool ok; if ( globals == nullptr ) diff --git a/out_of_tree/parsed_notifications.zip b/out_of_tree/parsed_notifications.zip index b936c9e..c300071 100644 Binary files a/out_of_tree/parsed_notifications.zip and b/out_of_tree/parsed_notifications.zip differ diff --git a/pydoc_injections2.txt b/pydoc_injections2.txt index 9a667bf..6ae8fef 100644 --- a/pydoc_injections2.txt +++ b/pydoc_injections2.txt @@ -55904,7 +55904,7 @@ execute_ui_requests(*args) @param callable_list: A list of python callable objects. @note: A callable should return True if it wants to be called more than once. - @return: Boolean. False if the list contains a non callabale item + @return: Boolean. False if the list contains a non callable item Help on function find_widget in module ida_kernwin: diff --git a/pydoc_injections3.txt b/pydoc_injections3.txt index 988ef72..5c68acd 100644 --- a/pydoc_injections3.txt +++ b/pydoc_injections3.txt @@ -56553,7 +56553,7 @@ execute_ui_requests(*args) -> 'bool' @param callable_list: A list of python callable objects. @note: A callable should return True if it wants to be called more than once. - @return: Boolean. False if the list contains a non callabale item + @return: Boolean. False if the list contains a non callable item Help on function find_widget in module ida_kernwin: diff --git a/python/idautils.py b/python/idautils.py index 0bf2271..325de5c 100644 --- a/python/idautils.py +++ b/python/idautils.py @@ -582,9 +582,14 @@ def GetInstructionList(): return [i[0] for i in ida_idp.ph_get_instruc() if i[0]] # ----------------------------------------------------------------------- -def _Assemble(ea, line): +def Assemble(ea, line): """ - Please refer to Assemble() - INTERNAL USE ONLY + Assembles one or more lines (does not display an message dialogs) + If line is a list then this function will attempt to assemble all the lines + This function will turn on batch mode temporarily so that no messages are displayed on the screen + + @param ea: start address + @return: (False, "Error message") or (True, asm_buf) or (True, [asm_buf1, asm_buf2, asm_buf3]) """ if type(line) in ([bytes] + list(ida_idaapi.string_types)): lines = [line] @@ -606,21 +611,11 @@ def _Assemble(ea, line): ret = ret[0] return (True, ret) +# ----------------------------------------------------------------------- +_Assemble = Assemble -def Assemble(ea, line): - """ - Assembles one or more lines (does not display an message dialogs) - If line is a list then this function will attempt to assemble all the lines - This function will turn on batch mode temporarily so that no messages are displayed on the screen - - @param ea: start address - @return: (False, "Error message") or (True, asm_buf) or (True, [asm_buf1, asm_buf2, asm_buf3]) - """ - old_batch = idc.batch(1) - ret = _Assemble(ea, line) - idc.batch(old_batch) - return ret +# ----------------------------------------------------------------------- def _copy_obj(src, dest, skip_list = None): """ Copy non private/non callable attributes from a class instance to another diff --git a/pywraps/py_kernwin.hpp b/pywraps/py_kernwin.hpp index edcb70c..0368076 100644 --- a/pywraps/py_kernwin.hpp +++ b/pywraps/py_kernwin.hpp @@ -667,7 +667,7 @@ def execute_ui_requests(callable_list): @param callable_list: A list of python callable objects. @note: A callable should return True if it wants to be called more than once. - @return: Boolean. False if the list contains a non callabale item + @return: Boolean. False if the list contains a non callable item """ pass # @@ -708,6 +708,17 @@ static bool py_execute_ui_requests(PyObject *py_list) ref_t py_callable = py_callables.at(py_callable_idx); bool reschedule; newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, nullptr)); + // execute_ui_requests() will cause this run() code to be executed + // asynchronously. This means that, should an exception have been raised + // in the Python code we just executed, it won't have the possibility of + // trickling all the way up to the Python runtime. + // Since it would interfere with subsequent Python code execution, we + // want to report it right away. + if ( PyErr_Occurred() ) + { + PyErr_Print(); + return false; + } reschedule = py_result != nullptr && PyObject_IsTrue(py_result.o); // No rescheduling? Then advance to the next callable diff --git a/release_pydoc_injections2.txt b/release_pydoc_injections2.txt index af33755..20c3c7f 100644 --- a/release_pydoc_injections2.txt +++ b/release_pydoc_injections2.txt @@ -6532,8 +6532,9 @@ Help on function set_reg_val in module ida_dbg: set_reg_val(*args) set_reg_val(regname, o) -> PyObject + Write a register value to the current thread. - @param regname: char const * + @param regname: (C++: const char *) char const * @param o: PyObject * set_reg_val(tid, regidx, o) -> bool, int @@ -55839,7 +55840,7 @@ execute_ui_requests(*args) @param callable_list: A list of python callable objects. @note: A callable should return True if it wants to be called more than once. - @return: Boolean. False if the list contains a non callabale item + @return: Boolean. False if the list contains a non callable item Help on function find_widget in module ida_kernwin: diff --git a/release_pydoc_injections3.txt b/release_pydoc_injections3.txt index 580bb85..faae0cd 100644 --- a/release_pydoc_injections3.txt +++ b/release_pydoc_injections3.txt @@ -6514,8 +6514,9 @@ Help on function set_reg_val in module ida_dbg: set_reg_val(*args) -> 'PyObject *' set_reg_val(regname, o) -> PyObject + Write a register value to the current thread. - @param regname: char const * + @param regname: (C++: const char *) char const * @param o: PyObject * set_reg_val(tid, regidx, o) -> bool, int @@ -56488,7 +56489,7 @@ execute_ui_requests(*args) -> 'bool' @param callable_list: A list of python callable objects. @note: A callable should return True if it wants to be called more than once. - @return: Boolean. False if the list contains a non callabale item + @return: Boolean. False if the list contains a non callable item Help on function find_widget in module ida_kernwin: