[issue24790] Idle: improve stack viewer

Can İbanoğlu report at bugs.python.org
Tue Aug 18 14:36:28 CEST 2015


Can İbanoğlu added the comment:

Hello again,

I have spent some time going over the code and how the PyShell brings all of this together and have formed some loose opinions on how to solve these issues but I wanted to get a much more informed opinion.

I will provide a patch for the first one first, so right now, all my questions are related to that one.

Basically, I have come up with three different places I could patch in StackViewer.py to remove "idlelib.run.runcode" from the stack viewer. 

First option is to patch the constructor of "StackTreeItem" so that if "idlelib.run.runcode" is in the traceback, it never gets pushed to the stack list. I don't like this approach very much because I would essentially be removing data from the stack. 

Second option is to patch the "GetSubList" method so that the iterated variable "info" is checked before constructing a new "FrameTreeItem". If "idlelib.run.runcode" is matched, we would just continue to the next value in the list. I think this would lead to repetitive code though. We would rewrite some of the "GetText" method of "FrameTreeItem" and then make a string comparison to identify the entry to be removed.

Third option is to call the "GetText" method after each created "FrameTreeItem" and make the string comparison then. This would add a lot of method calls if the stack is long. On the other hand, this approach doesn't repeat any code. 

It is highly possible that I have missed something very simple and elegant :) I would very much appreciate your input. I can make upload a patch once I get your approval. Which approach would be better here?

Something else that I would like to ask is the preparation of the patch file. Should switch to the 3.4 branch and then create the patch or can I do it at the dev branch? How would I check if the patch applies to 3.4/3.5/3.6 (apart from applying them manually and testing if it has the desired outcome)?

I'm sorry for the wall of text, I'm nervous and I don't want to mess something up. :)

Thanks a lot for your assistance.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24790>
_______________________________________


More information about the Python-bugs-list mailing list