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

Variable may be used before first being assigned to in Lib/locale.py #50869

Closed
vincele mannequin opened this issue Aug 1, 2009 · 4 comments
Closed

Variable may be used before first being assigned to in Lib/locale.py #50869

vincele mannequin opened this issue Aug 1, 2009 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@vincele
Copy link
Mannequin

vincele mannequin commented Aug 1, 2009

BPO 6620
Nosy @mdickinson
Files
  • py3k-locale.py-use-before-assignment.patch: Patch to initialize the var
  • _grouping_intervals.patch
  • 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 2009-08-04.22:00:29.723>
    created_at = <Date 2009-08-01.22:18:36.759>
    labels = ['library']
    title = 'Variable may be used before first being assigned to in Lib/locale.py'
    updated_at = <Date 2009-08-04.22:00:29.721>
    user = 'https://bugs.python.org/vincele'

    bugs.python.org fields:

    activity = <Date 2009-08-04.22:00:29.721>
    actor = 'mark.dickinson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-08-04.22:00:29.723>
    closer = 'mark.dickinson'
    components = ['Library (Lib)']
    creation = <Date 2009-08-01.22:18:36.759>
    creator = 'vincele'
    dependencies = []
    files = ['14622', '14627']
    hgrepos = []
    issue_num = 6620
    keywords = ['patch']
    message_count = 4.0
    messages = ['91173', '91186', '91274', '91277']
    nosy_count = 2.0
    nosy_names = ['mark.dickinson', 'vincele']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue6620'
    versions = ['Python 3.2']

    @vincele
    Copy link
    Mannequin Author

    vincele mannequin commented Aug 1, 2009

    The last_interval variable could potentially be used before being first
    assigned a value.

    @vincele vincele mannequin added the stdlib Python modules in the Lib dir label Aug 1, 2009
    @mdickinson
    Copy link
    Member

    So this can happen only if grouping is [0] (or an equivalent iterable).
    Since this is an invalid grouping, I think the appropriate response would
    be for _grouping_intervals([0]) to raise an exception (which is what it
    currently does as soon as you iterate over the result, though this is
    possibly not by design. :)

    Vincent, does the attached patch (_grouping_intervals.patch, against py3k)
    silence the pylint warning?

    @vincele
    Copy link
    Mannequin Author

    vincele mannequin commented Aug 4, 2009

    Yes it does

    @mdickinson
    Copy link
    Member

    Thanks. Committed in r74312 (trunk), r74313 (py3k).

    @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
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant