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

bug in rlcompleter #46473

Closed
donlorenzo mannequin opened this issue Mar 3, 2008 · 3 comments
Closed

bug in rlcompleter #46473

donlorenzo mannequin opened this issue Mar 3, 2008 · 3 comments
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@donlorenzo
Copy link
Mannequin

donlorenzo mannequin commented Mar 3, 2008

BPO 2220
Nosy @birkenfeld
Files
  • rlcompleter.patch: patch that fixes the bug
  • 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 2008-03-06.07:46:43.811>
    created_at = <Date 2008-03-03.10:49:38.783>
    labels = ['easy', 'type-bug', 'library']
    title = 'bug in rlcompleter'
    updated_at = <Date 2008-03-06.07:46:43.809>
    user = 'https://bugs.python.org/donlorenzo'

    bugs.python.org fields:

    activity = <Date 2008-03-06.07:46:43.809>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-03-06.07:46:43.811>
    closer = 'georg.brandl'
    components = ['Library (Lib)']
    creation = <Date 2008-03-03.10:49:38.783>
    creator = 'donlorenzo'
    dependencies = []
    files = ['9591']
    hgrepos = []
    issue_num = 2220
    keywords = ['patch', 'easy']
    message_count = 3.0
    messages = ['63208', '63212', '63312']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'donlorenzo']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue2220'
    versions = ['Python 2.5']

    @donlorenzo
    Copy link
    Mannequin Author

    donlorenzo mannequin commented Mar 3, 2008

    The following code would raise a TypeError:
    >>> rlcompleter.Completer().complete("print self.foo", 0)
    with this fix it will just return None

    @donlorenzo donlorenzo mannequin added type-crash A hard crash of the interpreter, possibly with a core dump stdlib Python modules in the Lib dir labels Mar 3, 2008
    @donlorenzo
    Copy link
    Mannequin Author

    donlorenzo mannequin commented Mar 3, 2008

    Some more information:
    the dot in the example causes complete() to call self.attr_matches(text)
    which in turn performes the following call
    re.match(r"(\w+(\.\w+))\.(\w)", text)
    and return None if there is no match.
    the complete method unconditionally accesses the return value like a
    list via
    matches[state]
    which raises the TypeError.
    The obvious solution was to return an empty list instead of None which
    is also the behaviour in all other cases where no completion is found.

    @benjaminp benjaminp added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Mar 3, 2008
    @akuchling akuchling added the easy label Mar 5, 2008
    @birkenfeld
    Copy link
    Member

    Fixed in r61275, r61276 (2.5).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    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

    3 participants