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

If use element from for in while loop it will have bad iterate. #84490

Closed
MaksBleo mannequin opened this issue Apr 17, 2020 · 3 comments
Closed

If use element from for in while loop it will have bad iterate. #84490

MaksBleo mannequin opened this issue Apr 17, 2020 · 3 comments
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@MaksBleo
Copy link
Mannequin

MaksBleo mannequin commented Apr 17, 2020

BPO 40310
Nosy @remilapeyre
Files
  • cars_av_by_spider_scr.py
  • 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 2020-04-17.11:06:33.321>
    created_at = <Date 2020-04-17.10:17:23.187>
    labels = ['interpreter-core', 'invalid', 'type-bug', '3.7']
    title = 'If use element from for in while loop it will have bad iterate.'
    updated_at = <Date 2020-04-17.11:06:33.320>
    user = 'https://bugs.python.org/MaksBleo'

    bugs.python.org fields:

    activity = <Date 2020-04-17.11:06:33.320>
    actor = 'Maks Bleo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-17.11:06:33.321>
    closer = 'Maks Bleo'
    components = ['Interpreter Core']
    creation = <Date 2020-04-17.10:17:23.187>
    creator = 'Maks Bleo'
    dependencies = []
    files = ['49071']
    hgrepos = []
    issue_num = 40310
    keywords = []
    message_count = 3.0
    messages = ['366652', '366654', '366655']
    nosy_count = 2.0
    nosy_names = ['remi.lapeyre', 'Maks Bleo']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40310'
    versions = ['Python 3.7']

    @MaksBleo
    Copy link
    Mannequin Author

    MaksBleo mannequin commented Apr 17, 2020

    Windows 10
    Version 1909 (OS Build18363.778)
    Python 3.7.7 x64

    cars_av_by_spider_scr.py - py file for scrapy.
    bash command to use
    scrapy runspider cars_av_by_spider_scr.py -o cars_av_by_spider_scr.json > cars_av_by_spider_scr.txt 2>&1

    Bad behavior in line 52. (In comment fixed version)

    When while loop iterate on second step instead of using
    model[0], model[1] it start use model[1][0] and model[1][1].
    On third step it crash, out of range.

    But if assign value before while loop and use it in while loop everything work fine.

    It's my first bug report.

    @MaksBleo MaksBleo mannequin added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Apr 17, 2020
    @remilapeyre
    Copy link
    Mannequin

    remilapeyre mannequin commented Apr 17, 2020

    Hi Maks, when you report a bug please write a minimal example that show the bug so we don't have to read the whole application (https://stackoverflow.com/help/minimal-reproducible-example).

    I think in this case that the issue is that you overrride model on line 65 model = car[1] hence the error on the next iteration, model has been replaced.

    This bug tracker is for bugs in the Python interpreter, for help in using Python please use the python-help mailing list or a forum like StackOverflow.

    @MaksBleo
    Copy link
    Mannequin Author

    MaksBleo mannequin commented Apr 17, 2020

    I don't think that it will overwrite element from for loop. In my mind it
    was a bug.

    Thank you.

    On Fri, Apr 17, 2020, 1:59 PM Rémi Lapeyre <report@bugs.python.org> wrote:

    Rémi Lapeyre remi.lapeyre@henki.fr added the comment:

    Hi Maks, when you report a bug please write a minimal example that show
    the bug so we don't have to read the whole application (
    https://stackoverflow.com/help/minimal-reproducible-example).

    I think in this case that the issue is that you overrride model on line 65
    model = car[1] hence the error on the next iteration, model has been
    replaced.

    This bug tracker is for bugs in the Python interpreter, for help in using
    Python please use the python-help mailing list or a forum like
    StackOverflow.

    ----------
    nosy: +remi.lapeyre


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue40310\>


    @MaksBleo MaksBleo mannequin closed this as completed Apr 17, 2020
    @MaksBleo MaksBleo mannequin added the invalid label Apr 17, 2020
    @MaksBleo MaksBleo mannequin closed this as completed Apr 17, 2020
    @MaksBleo MaksBleo mannequin added the invalid label Apr 17, 2020
    @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
    3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants