[gedit] Fix Bug 734185 - Python debug_plugin_message results in AttributeError or wrong file/line
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Fix Bug 734185 - Python debug_plugin_message results in AttributeError or wrong file/line
- Date: Sun, 14 Sep 2014 13:13:18 +0000 (UTC)
commit fadfe8492d52695f4499826a53c1357d7bea3eaf
Author: Daniel Trebbien <dtrebbien gmail com>
Date: Sun Sep 14 08:49:17 2014 -0400
Fix Bug 734185 - Python debug_plugin_message results in AttributeError or wrong file/line
Before overwriting the `frame` local variable, check that `frame.f_back`
is not None. Also, change the `num_back_frames` argument to get_trace_info()
in the debug_plugin_message() override from 2 to 1 because the @override
decorator had one level of indirection removed.
gedit/Gedit.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gedit/Gedit.py b/gedit/Gedit.py
index 4bf9e06..5aed5f9 100644
--- a/gedit/Gedit.py
+++ b/gedit/Gedit.py
@@ -49,7 +49,10 @@ def get_trace_info(num_back_frames=0):
frame = inspect.currentframe().f_back
try:
for i in range(num_back_frames):
- frame = frame.f_back
+ back_frame = frame.f_back
+ if back_frame == None:
+ break
+ frame = back_frame
filename = frame.f_code.co_filename
@@ -73,7 +76,7 @@ orig_debug_plugin_message_func = Gedit.debug_plugin_message
@override(Gedit.debug_plugin_message)
def debug_plugin_message(format, *format_args):
- filename, lineno, func_name = get_trace_info(2)
+ filename, lineno, func_name = get_trace_info(1)
orig_debug_plugin_message_func(filename, lineno, func_name, format % format_args)
__all__.append(debug_plugin_message)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]