Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace.CoverageResult fails merging input file with non-empty callers #51524

Closed
glinsvad mannequin opened this issue Nov 6, 2009 · 5 comments
Closed

trace.CoverageResult fails merging input file with non-empty callers #51524

glinsvad mannequin opened this issue Nov 6, 2009 · 5 comments
Labels
3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@glinsvad
Copy link
Mannequin

glinsvad mannequin commented Nov 6, 2009

BPO 7275
Nosy @berkerpeksag, @iritkatriel
Files
  • trace.diff: Proposed patch for out of place 'callers' argument
  • issue7275.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2009-11-06.18:12:00.434>
    labels = ['easy', 'type-bug', '3.9', '3.10', '3.11', 'library']
    title = 'CoverageResult fails to merge input file with non-empty callers in trace.py'
    updated_at = <Date 2022-01-20.23:10:32.121>
    user = 'https://bugs.python.org/glinsvad'

    bugs.python.org fields:

    activity = <Date 2022-01-20.23:10:32.121>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2009-11-06.18:12:00.434>
    creator = 'glinsvad'
    dependencies = []
    files = ['15279', '42558']
    hgrepos = []
    issue_num = 7275
    keywords = ['easy']
    message_count = 4.0
    messages = ['94991', '109980', '263925', '411054']
    nosy_count = 4.0
    nosy_names = ['dstanek', 'glinsvad', 'berker.peksag', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7275'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Linked PRs

    @glinsvad
    Copy link
    Mannequin Author

    glinsvad mannequin commented Nov 6, 2009

    trace.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

    @glinsvad glinsvad mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 6, 2009
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 11, 2010

    The attached patch is effectively a one liner.

    @berkerpeksag
    Copy link
    Member

    Thanks for the report and for the patch, Christian. Here is a patch with a test.

    @berkerpeksag berkerpeksag changed the 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 Apr 21, 2016
    @iritkatriel iritkatriel added easy 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Jan 20, 2022
    @iritkatriel
    Copy link
    Member

    The patch needs to be converted to a GitHub PR.

    @furkanonder
    Copy link
    Contributor

    @iritkatriel I opened a PR for this issue.

    @terryjreedy terryjreedy changed the title CoverageResult fails to merge input file with non-empty callers in trace.py trace.CoverageResult fails merging input file with non-empty callers Nov 20, 2022
    @terryjreedy terryjreedy removed the 3.9 only security fixes label Nov 20, 2022
    terryjreedy added a commit that referenced this issue Nov 28, 2022
    #99629)
    
    Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 28, 2022
    … infile (pythonGH-99629)
    
    (cherry picked from commit 594de16)
    
    Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
    Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 28, 2022
    … infile (pythonGH-99629)
    
    (cherry picked from commit 594de16)
    
    Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
    Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
    miss-islington added a commit that referenced this issue Nov 28, 2022
    GH-99629)
    
    (cherry picked from commit 594de16)
    
    Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
    Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
    miss-islington added a commit that referenced this issue Nov 28, 2022
    GH-99629)
    
    (cherry picked from commit 594de16)
    
    Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
    Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes 3.11 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants