Skip to content

Setting Invalid sys.stdin in interactive mode => loop forever. #55939

Closed

Description

@ysjray
mannequin
BPO 11730
Nosy @vstinner

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 2011-04-02.08:28:53.523>
created_at = <Date 2011-03-31.15:17:18.470>
labels = ['interpreter-core', 'type-crash']
title = 'Setting Invalid sys.stdin in interactive mode =>  loop forever.'
updated_at = <Date 2011-04-02.08:28:53.522>
user = 'https://bugs.python.org/ysjray'

bugs.python.org fields:

activity = <Date 2011-04-02.08:28:53.522>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2011-04-02.08:28:53.523>
closer = 'vstinner'
components = ['Interpreter Core']
creation = <Date 2011-03-31.15:17:18.470>
creator = 'ysj.ray'
dependencies = []
files = []
hgrepos = []
issue_num = 11730
keywords = []
message_count = 2.0
messages = ['132678', '132789']
nosy_count = 2.0
nosy_names = ['vstinner', 'ysj.ray']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = 'needs patch'
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue11730'
versions = ['Python 3.1', 'Python 3.2', 'Python 3.3']

Activity

  1. ysjray commented on Mar 31, 2011

    ysjraymannequin
    MannequinAuthor

    Setting sys.stdin to an invalid input stream under interactive mode causes interpreter run loop forever:

    Python 3.3a0 (default:22ae2b002865+, Mar 30 2011, 21:17:03) 
    [GCC 4.4.4] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    [57804 refs]
    >>> sys.stdin = None
    [57809 refs]
    [57809 refs]
    [57809 refs]
    [57809 refs]
    [57809 refs]
    ......

    Not only setting to None but also to any other invalid input stream could cause this. It's because in the beginning of PyRun_InteractiveOneFlags(), in order to get stdin encoding, the code tries to get sys.stdin and check if it's valid(not NULL, not None, has "encoding" attribute), if not, return -1 directly, then the loop in PyRun_InteractLoopFlags() continues and does the same thing. I think this should be fixed by using the Py_FileSystemDefaultEncoding instead when sys.stdin is invalid.

  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Mar 31, 2011
  3. changed the title [-]Setting sys.stdin to an invalid input stream causes interpreter run loop forever.[/-] [+]Setting Invalid sys.stdin in interactive mode => loop forever.[/+] on Apr 2, 2011
  4. vstinner commented on Apr 2, 2011

    @vstinner
    Member

    I think that it is a duplicate of bpo-8070.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions