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

script exited with exit break from pypy interactive mode #2981

Open
gitlab-importer opened this issue Mar 27, 2019 · 2 comments · May be fixed by #4947
Open

script exited with exit break from pypy interactive mode #2981

gitlab-importer opened this issue Mar 27, 2019 · 2 comments · May be fixed by #4947
Labels
bug Something isn't working

Comments

@gitlab-importer
Copy link

In Heptapod by bitbucket_importer on Mar 27, 2019, 05:05

Created originally on Bitbucket by thiner_never_stop_exploiting (wrq)

pypy -i -c 'exit(-1)' did not provide an interactive pypy console on exit, and so do any script exited with the obvious exit function; sys.exit is unaffected.

I use pypy2, so more versions are not tested, I would suggest that anyone test this on all platforms.

[dummy@f2e2157eeb03 project]$ pypy -i -c 'import sys;sys.exit(-1)'
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 76, in handle_sys_exit
SystemExit: -1
>>>> 
[dummy@f2e2157eeb03 project]$ pypy -i -c 'exit(-1)'
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 76, in handle_sys_exit
SystemExit: -1
Traceback (most recent call last):
  File "/usr/lib64/pypy-6.0/lib_pypy/_pypy_interact.py", line 30, in interactive_console
    if not os.isatty(sys.stdin.fileno()):
ValueError: I/O operation on closed file
[dummy@f2e2157eeb03 project]$ python -i -c 'import sys;sys.exit(-1)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemExit: -1
>>> 
[dummy@f2e2157eeb03 project]$ python -i -c 'exit(-1)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/site.py", line 355, in __call__
    raise SystemExit(code)
SystemExit: -1
>>> 
[dummy@f2e2157eeb03 project]$ pypy --version
Python 2.7.13 (1d8462e42c37, Aug 30 2018, 09:58:57)
[PyPy 6.0.0 with GCC 8.2.1 20180801 (Red Hat 8.2.1-2)]

@gitlab-importer
Copy link
Author

In Heptapod by @arigo on Mar 27, 2019, 10:13

Note that it isn't related to the value -1. It occurs with a nonnegative value too.

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Mar 28, 2019, 11:25

That's not really a difference to CPython though. in CPython you do get a prompt and you can use it somewhat, but sys.stdin is still closed, and things like raw_input don't work. The difference is that in PyPy the interactive prompt is built on top of sys.stdin. So I fear we are a bit stuck with this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant