This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: CoverageResult fails to merge input file with non-empty callers in trace.py
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, dstanek, glinsvad, iritkatriel
Priority: normal Keywords: easy

Created on 2009-11-06 18:12 by glinsvad, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
trace.diff glinsvad, 2009-11-06 18:11 Proposed patch for out of place 'callers' argument review
issue7275.diff berker.peksag, 2016-04-21 15:56 review
Messages (4)
msg94991 - (view) Author: Christian Glinsvad (glinsvad) Date: 2009-11-06 18:11
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
msg109980 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-11 10:15
The attached patch is effectively a one liner.
msg263925 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-04-21 15:56
Thanks for the report and for the patch, Christian. Here is a patch with a test.
msg411054 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-20 23:10
The patch needs to be converted to a GitHub PR.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51524
2022-01-20 23:10:32iritkatrielsetnosy: + iritkatriel
messages: + msg411054
2022-01-20 23:10:11iritkatrielsetkeywords: + easy, - patch
versions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.5, Python 3.6
2016-04-21 15:56:10berker.peksagsetfiles: + issue7275.diff
title: CoverageResult fails to merge input file with non-empty callers in trace.py (patch) -> CoverageResult fails to merge input file with non-empty callers in trace.py
nosy: + berker.peksag

messages: + msg263925

versions: + Python 3.5, Python 3.6, - Python 3.1, Python 2.7, Python 3.2
2014-02-03 19:49:43BreamoreBoysetnosy: - BreamoreBoy
2010-08-18 00:14:20dstaneksetnosy: + dstanek
2010-07-11 10:15:14BreamoreBoysetversions: - Python 2.6, Python 2.5, Python 2.4, Python 3.0
nosy: + BreamoreBoy

messages: + msg109980

stage: patch review
2009-11-06 18:12:00glinsvadcreate