[New-bugs-announce] [issue7275] CoverageResult fails to merge input file with non-empty callers in trace.py (patch)

Christian Glinsvad report at bugs.python.org
Fri Nov 6 19:12:01 CET 2009


New submission from Christian Glinsvad <glinsvad at hotmail.com>:

CoverageResults expects arguments in the order "counts, calledfuncs,
infile, callers..." but the try statement in the last part of __init__
passes "counts, calledfuncs, callers" as positional arguments to a new
instance of the same class. Thus, the secondary instance erroneously
obtains a dict for the "infile" argument, so I propose passing "callers"
as a keyword argument to avoid this.

Not that this has gone unnoticed because an empty dict for the "infile"
argument evaluates to False in "if self.infile:", which must have been
intended as "if self.infile is not None:". If, however, the original
instance loads a pickle file with a non-empty "callers" argument, the
secondary instance tries to run "open({}, 'rb')", which yields:

TypeError: coercing to Unicode: need string or buffer, dict found

----------
components: Library (Lib)
files: trace.diff
keywords: patch
messages: 94991
nosy: glinsvad
severity: normal
status: open
title: CoverageResult fails to merge input file with non-empty callers in trace.py (patch)
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15279/trace.diff

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


More information about the New-bugs-announce mailing list