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

infinite loop in PyRun_InteractiveLoopFlags() #74881

Closed
xdegaye mannequin opened this issue Jun 18, 2017 · 9 comments
Closed

infinite loop in PyRun_InteractiveLoopFlags() #74881

xdegaye mannequin opened this issue Jun 18, 2017 · 9 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

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Jun 18, 2017

BPO 30696
Nosy @vstinner, @xdegaye
PRs
  • bpo-30696: Fix the REPL looping endlessly when no memory #4160
  • [3.6] bpo-30696: Fix the REPL looping endlessly when no memory (GH-41… #4379
  • Files
  • infinite_loop.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 2017-11-12.16:33:59.948>
    created_at = <Date 2017-06-18.10:33:04.834>
    labels = ['interpreter-core', 'type-bug', '3.7']
    title = 'infinite loop in PyRun_InteractiveLoopFlags()'
    updated_at = <Date 2017-11-13.12:40:12.021>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-13.12:40:12.021>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-12.16:33:59.948>
    closer = 'xdegaye'
    components = ['Interpreter Core']
    creation = <Date 2017-06-18.10:33:04.834>
    creator = 'xdegaye'
    dependencies = []
    files = ['46959']
    hgrepos = []
    issue_num = 30696
    keywords = ['patch']
    message_count = 9.0
    messages = ['296267', '296322', '296324', '306118', '306120', '306151', '306152', '306153', '306155']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'xdegaye']
    pr_nums = ['4160', '4379']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30696'
    versions = ['Python 3.6', 'Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jun 18, 2017

    To reproduce the problem, apply the nomemory_allocator.patch from issue 30695 and run the following two statements that must be interrupted with ^C:
    $  ./python -q
    >>> import _testcapi
    >>> _testcapi.set_nomemory_allocator()
    sys.excepthook is missing
    ^Cpython: Objects/call.c:785: PyEval_CallObjectWithKeywords: Assertion `!PyErr_Occurred()' failed.
    Aborted (core dumped)

    The attached patch fixes this problem.
    No PR for the moment: this patch and nomemory_allocator.patch are needed to demonstrate other issues.

    @xdegaye xdegaye 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 Jun 18, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jun 19, 2017

    The patch is far too simplistic. With this patch an exception kills the interactive loop, for example:

    $ ./python -q
    >>> x
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'x' is not defined
    $

    @vstinner
    Copy link
    Member

    See also my old issue bpo-8070 opened 7 years ago :-)

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 12, 2017

    New changeset e0582a3 by xdegaye in branch 'master':
    bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160)
    e0582a3

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 12, 2017

    New changeset ea5b545 by xdegaye in branch '3.6':
    [3.6] bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160). (bpo-4379)
    ea5b545

    @xdegaye xdegaye mannequin closed this as completed Nov 12, 2017
    @vstinner
    Copy link
    Member

    Thanks for fixing this very old bug!

    What about Python 2.7?

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 13, 2017

    What about Python 2.7?

    _testcapi.set_nomemory() does not exist on Pyhton 2.7 so the changes cannot be tested. Applying the changes to PyRun_InteractiveLoopFlags() in 2.7 looks rather straightforward but there are too many differences in PyRun_InteractiveOneFlags() between 2.7 and 3.7.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 13, 2017

    Also the existing test coverage of these functions in all the Python versions is very weak.

    @vstinner
    Copy link
    Member

    Ok, I understand, thanks for the explanation.

    @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

    1 participant