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

Better inspect.BlockFinder fixes bug #37431

Closed
pobrien mannequin opened this issue Nov 6, 2002 · 4 comments
Closed

Better inspect.BlockFinder fixes bug #37431

pobrien mannequin opened this issue Nov 6, 2002 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@pobrien
Copy link
Mannequin

pobrien mannequin commented Nov 6, 2002

BPO 634557
Nosy @rhettinger
Files
  • inspect.patch: diff -c patch for inspect.py from CVS
  • 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 = <Date 2003-01-19.13:26:07.000>
    created_at = <Date 2002-11-06.18:04:06.000>
    labels = ['library']
    title = 'Better inspect.BlockFinder fixes bug'
    updated_at = <Date 2003-01-19.13:26:07.000>
    user = 'https://bugs.python.org/pobrien'

    bugs.python.org fields:

    activity = <Date 2003-01-19.13:26:07.000>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2002-11-06.18:04:06.000>
    creator = 'pobrien'
    dependencies = []
    files = ['4688']
    hgrepos = []
    issue_num = 634557
    keywords = ['patch']
    message_count = 4.0
    messages = ['41581', '41582', '41583', '41584']
    nosy_count = 3.0
    nosy_names = ['nnorwitz', 'rhettinger', 'pobrien']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue634557'
    versions = ['Python 2.2']

    @pobrien
    Copy link
    Mannequin Author

    pobrien mannequin commented Nov 6, 2002

    inspect.BlockFinder didn't do a good enough job finding  
    the end of code blocks. This can be observed by  
    running:  
      
    >>> import inspect  
    >>> import tokenize  
    >>> print inspect.getsource(tokenize.TokenError)  
    class TokenError(Exception): pass  
      
    class StopTokenizing(Exception): pass  
      
    def printtoken(type, token, (srow, scol), (erow, ecol),  
    line): # for testing  
        print "%d,%d-%d,%d:\t%s\t%s" % \  
            (srow, scol, erow, ecol, tok_name[type],  
    repr(token))  
      
    >>>   
      
    Notice how it picks up extra source code lines. The  
    attached patch fixes this problem. There should probably 
    be some additional unit tests for this, but I ran out of time 
    and energy.

    @pobrien pobrien mannequin closed this as completed Nov 6, 2002
    @pobrien pobrien mannequin added the stdlib Python modules in the Lib dir label Nov 6, 2002
    @pobrien pobrien mannequin closed this as completed Nov 6, 2002
    @pobrien pobrien mannequin added the stdlib Python modules in the Lib dir label Nov 6, 2002
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Nov 6, 2002

    Logged In: YES
    user_id=33168

    Does this fix bug bpo-595018? There are a few other inspect
    module bugs I think.

    @pobrien
    Copy link
    Mannequin Author

    pobrien mannequin commented Nov 6, 2002

    Logged In: YES
    user_id=179604

    Yes, this does fix bug bpo-595018. I'll look at the other inspect
    module bugs when I've got some spare time.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    I spent a little time testing this one and checked to make
    sure it didn't clash with my fixes.

    Marking as accepted and applying as Lib/inspect 1.41.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant