This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: input fucntion raises SystemError after specific input.
Type: behavior Stage: resolved
Components: IO Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Amiy, benjamin.peterson, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2019-09-13 10:31 by Amiy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
input-test.py Amiy, 2019-09-13 10:31 Input function test file.
Pull Requests
URL Status Linked Edit
PR 21569 merged benjamin.peterson, 2020-07-20 22:01
PR 21670 merged miss-islington, 2020-07-29 00:57
PR 21671 merged miss-islington, 2020-07-29 00:57
PR 21721 merged vstinner, 2020-08-04 00:04
PR 21723 merged miss-islington, 2020-08-04 00:38
PR 21725 merged miss-islington, 2020-08-04 00:40
Messages (7)
msg352282 - (view) Author: Amiy (Amiy) Date: 2019-09-13 10:31
input function raises a SystemError in bash(similar shells)
when given inputs follow a certain pattern, doesn't happen in python interactive shell.

It causes crash in python scripts even if KeyboardInterrupt and EOFError are handeled.

No EOFError or KeyboardInterrupt error is raised in such cases.

Tested with python script: (file input-test.py)
and command:
python -c 'input()'
both yield same result.

Inputs are represented as: ^D :- CTRL+d, ^C :- CTRL+c 

eg:
input:
sometext^D^D^C

Traceback:
[182]$ python -c 'input()'
sometext^CKeyboardInterrupt

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemError: <built-in function input> returned a result with an error set

-----

inputs:
sometext^D^C^C [or even] sometext^Dsome-more^C^C

Traceback:
[191]$ python input-test.py
sometext^C^CKeyboardInterrupt

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "input-test.py", line 2, in <module>
    tmp = input()
SystemError: <built-in function input> returned a result with an error set

Python version: 3.7
Bash version: 5.0.11
msg374552 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-07-29 00:57
New changeset a74eea238f5baba15797e2e8b570d153bc8690a7 by Benjamin Peterson in branch 'master':
closes bpo-38156: Always handle interrupts in PyOS_StdioReadline. (GH-21569)
https://github.com/python/cpython/commit/a74eea238f5baba15797e2e8b570d153bc8690a7
msg374553 - (view) Author: miss-islington (miss-islington) Date: 2020-07-29 01:16
New changeset 22216107f2890e7ee2ab055e4983b76ff9c62169 by Miss Islington (bot) in branch '3.9':
closes bpo-38156: Always handle interrupts in PyOS_StdioReadline. (GH-21569)
https://github.com/python/cpython/commit/22216107f2890e7ee2ab055e4983b76ff9c62169
msg374554 - (view) Author: miss-islington (miss-islington) Date: 2020-07-29 01:16
New changeset 7cfede6859586f77f786bda56af4698ae2245f56 by Miss Islington (bot) in branch '3.8':
closes bpo-38156: Always handle interrupts in PyOS_StdioReadline. (GH-21569)
https://github.com/python/cpython/commit/7cfede6859586f77f786bda56af4698ae2245f56
msg374777 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-04 00:38
New changeset bde48fd8110cc5f128d5db44810d17811e328a24 by Victor Stinner in branch 'master':
bpo-38156: Fix compiler warning in PyOS_StdioReadline() (GH-21721)
https://github.com/python/cpython/commit/bde48fd8110cc5f128d5db44810d17811e328a24
msg374779 - (view) Author: miss-islington (miss-islington) Date: 2020-08-04 00:57
New changeset b6724be8047ac2404aab870d35d8f95bb0b7036a by Miss Islington (bot) in branch '3.9':
bpo-38156: Fix compiler warning in PyOS_StdioReadline() (GH-21721)
https://github.com/python/cpython/commit/b6724be8047ac2404aab870d35d8f95bb0b7036a
msg374781 - (view) Author: miss-islington (miss-islington) Date: 2020-08-04 00:59
New changeset 46e448abbf35c051e5306a4695670d7ec7abc4e9 by Miss Islington (bot) in branch '3.8':
bpo-38156: Fix compiler warning in PyOS_StdioReadline() (GH-21721)
https://github.com/python/cpython/commit/46e448abbf35c051e5306a4695670d7ec7abc4e9
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82337
2020-08-04 00:59:05miss-islingtonsetmessages: + msg374781
2020-08-04 00:57:01miss-islingtonsetmessages: + msg374779
2020-08-04 00:40:40miss-islingtonsetpull_requests: + pull_request20868
2020-08-04 00:38:58miss-islingtonsetpull_requests: + pull_request20866
2020-08-04 00:38:23vstinnersetmessages: + msg374777
2020-08-04 00:04:12vstinnersetnosy: + vstinner

pull_requests: + pull_request20864
2020-07-29 01:16:26miss-islingtonsetmessages: + msg374554
2020-07-29 01:16:26miss-islingtonsetmessages: + msg374553
2020-07-29 00:57:36miss-islingtonsetpull_requests: + pull_request20815
2020-07-29 00:57:28miss-islingtonsetnosy: + miss-islington

pull_requests: + pull_request20814
2020-07-29 00:57:19benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg374552

stage: patch review -> resolved
2020-07-20 22:01:48benjamin.petersonsetkeywords: + patch
nosy: + benjamin.peterson

pull_requests: + pull_request20712
stage: patch review
2019-09-13 11:06:00Amiysettype: crash -> behavior
2019-09-13 10:31:38Amiycreate