Skip to content

trace does not ignore --ignore-module #54894

Open

Description

@RusiMody
mannequin
BPO 10685
Nosy @terryjreedy, @abalkin
Files
  • trace.diff: Patch for trace.py
  • test_ignoredir.py: Test --ignore-dir for --listfuncs and --trackcalls
  • 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 2010-12-12.12:34:28.214>
    labels = ['type-bug']
    title = 'trace does not ignore --ignore-module'
    updated_at = <Date 2018-04-13.16:39:57.662>
    user = 'https://bugs.python.org/RusiMody'

    bugs.python.org fields:

    activity = <Date 2018-04-13.16:39:57.662>
    actor = 'tomhines'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2010-12-12.12:34:28.214>
    creator = 'RusiMody'
    dependencies = []
    files = ['32437', '39503']
    hgrepos = []
    issue_num = 10685
    keywords = ['patch']
    message_count = 8.0
    messages = ['123836', '124264', '201822', '243438', '243462', '243510', '244086', '315250']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'belopolsky', 'RusiMody', 'tomhines']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue10685'
    versions = ['Python 2.7']

    Linked PRs

    Activity

    1. RusiMody commented on Dec 12, 2010

      RusiModymannequin
      MannequinAuthor

      When running trace, I get a a lot of lines like:
      filename: /usr/lib/python2.7/cmd.py, modulename: cmd, funcname: Cmd

      That is to say system modules are shown in the trace whereas I only want to see the code I am working on

      Ive tried
      python2.7 -m trace --listfuncs tt.py --ignore-dir '/usr/lib' > const-dir.trace

      python2.7 -m trace --listfuncs --ignore-module cmd tt.py > const.trace

      python2.7 -m trace --ignore-module --listfuncs cmd tt.py > const.trace

    2. terryjreedy commented on Dec 17, 2010

      @terryjreedy
      Member

      Please try the recent 2.7.1 release. This needs to be tested with current 3.1.3 or 3.1.b+ also.

    3. changed the title [-]trace does nto ignore --ignore-module[/-] [+]trace does not ignore --ignore-module[/+] on Dec 17, 2010
    4. tomhines commented on Oct 31, 2013

      tomhinesmannequin
      Mannequin

      The trace module ignores the --ignore-dir option for both the --listfuncs and --trackcalls modes. I have attached a patch.

    5. terryjreedy commented on May 18, 2015

      @terryjreedy
      Member
    6. tomhines commented on May 18, 2015

      tomhinesmannequin
      Mannequin

      Done.

      On Sun, May 17, 2015 at 8:42 PM, Terry J. Reedy <report@bugs.python.org>
      wrote:

      Terry J. Reedy added the comment:

      Tom, please sign the PSF Contributor Agreement
      https://www.python.org/psf/contrib/
      https://www.python.org/psf/contrib/contrib-form/

      ----------


      Python tracker <report@bugs.python.org>
      <http://bugs.python.org/issue10685\>


    7. terryjreedy commented on May 18, 2015

      @terryjreedy
      Member

      (When replying by email to an email, please remove any quotation, except possibly for a specific line or two. The message already appears about yours on the tracker.)

      Good. It will take about a week for the * to appear after your name.

      As the diff is posted, hg could not find trace.py to patch. Changing
      --- Lib/trace.py Fri Feb 24 15:58:24 2012
      +++ Lib/trace.py Wed Oct 30 16:35:49 2013
      <to>
      --- a/Lib/trace.py Fri Feb 24 15:58:24 2012
      +++ b/Lib/trace.py Wed Oct 30 16:35:49 2013
      fixed that problem, and 3/4 chunks apply to 3.4 (map has already been replaced).

      Running test/test_trace.py (with repository 3.4) gives the same errors as without the patch. The changes look sensible. However, a test is needed that fails without the patch and passes with it. Can you write one that could be added to the test file, or at least pieces of a test and a manual test procedure?

    8. tomhines commented on May 26, 2015

      tomhinesmannequin
      Mannequin

      Test attached. Paste into test/test_trace.py. I tested in 2.7 and 3.4. Feel free to modify it.

    9. tomhines commented on Apr 13, 2018

      tomhinesmannequin
      Mannequin

      bump

    10. transferred this issue fromon Apr 10, 2022
    11. FirefighterBlu3 commented on Jun 10, 2022

      @FirefighterBlu3

      bump again?

    12. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Nov 28, 2023
    13. vasiliyk commented on Oct 19, 2026

      @vasiliyk
      Contributor

      Still reproduces on main (3.16.0a1+dev).
      --ignore-dir and --ignore-module are respected by --trace, --count but not by --listfuncs or --trackcalls.

      I opened gh-162469, with a credit to Tom Hines for the original patch.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions