New issue 2934: Interactive shell imports code.py from .
https://bitbucket.org/pypy/pypy/issues/2934/interactive-shell-imports-codepy-from

Stefano Rivera:

Because of nested imports inside the the interactive console code, the import 
of the `code` module is done after `site.py` has put `.` early in `sys.path`.

This means that if you have a `code.py` in your current directory, with e.g. 
some Python3 code in it, `print('a', end=' ')`, the REPL just crashes.

```
$ pypy
Python 2.7.13 (6.0.0+dfsg-3+b1, Oct 10 2018, 09:33:53)
[PyPy 6.0.0 with GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/usr/lib/pypy/lib_pypy/_pypy_interact.py", line 42, in 
interactive_console
    run_multiline_interactive_console(mainmodule, future_flags=future_flags)
  File "/usr/lib/pypy/lib_pypy/pyrepl/simple_interact.py", line 47, in 
run_multiline_interactive_console
    import code
  File "code.py", line 1
    print('a', end='bar')
                  ^
SyntaxError: invalid syntax (expected ')')
```


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to