[issue20888] tracemalloc: add a get_line() method to Trace and Frame classes

STINNER Victor report at bugs.python.org
Tue Mar 11 08:26:10 CET 2014


STINNER Victor added the comment:

The method name should be "get_line", not "getline", to conform to the PEP 8.

It's not very useful to add an helper to the Traceback, it's more interesting to add it to the Trace class. So linecache.getline(trace.traceback[0].filename, trace.traceback[0].lineno) just becomes trace.get_line().

I updated the patch: tracemalloc_get_line-2.patch.

> Yes it is too late.

Ok. I applied to most interesting change (on the documentation) for Python 3.4.1.

About the patch, is it a bad thing to add new methods (get_line) to such debug module in a minor version (3.4.1)? It can be surprising if sometimes try the same code on Python 3.4.1 and 3.4.0.

Well, the proposed addition is just an helper, linecache can still used ;-) It's just convinient to write "one-shot" script (use and delete) using tracemalloc.

----------
title: tracemalloc: add getline() method to Traceback and Frame -> tracemalloc: add a get_line() method to Trace and Frame classes
Added file: http://bugs.python.org/file34350/tracemalloc_get_line-2.patch

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


More information about the Python-bugs-list mailing list