[issue17646] traceback.py has a lot of code duplication

Martin Morrison report at bugs.python.org
Sat Apr 6 19:23:44 CEST 2013


New submission from Martin Morrison:

traceback.py contains a lot of code duplication, which makes it fragile in the face of changes (i.e. special cases) to the stack/traceback output (I am separately working on just such a change).

The attached patch refactors the code to reduce to a single function for each bit of logic, wrapped by the various existing APIs. The new helper functions are refactored as generators so as not to create unnecessary transient lists (not that stacks usually get very big anyway).

I've fully tested the replacement module, and it passes all the traceback tests in the standard suite.

----------
components: Library (Lib)
files: traceback.diff
keywords: patch
messages: 186142
nosy: isoschiz
priority: normal
severity: normal
status: open
title: traceback.py has a lot of code duplication
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29692/traceback.diff

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


More information about the Python-bugs-list mailing list