-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support multiline function/class definitions in REPL and InteractiveConsole #5743
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
Conversation
Please let me know if there's a good place to add tests for this! This is definitely a short-term fix though, and a better long term solution would be do what cPython does, and have a subclass of SyntaxException errors that indicate that it could be incomplete input. Also, it would probably be better to have the shell just execute |
Hopefully once ctypes works _pyrepl will become the default, but this is a good fix. |
Actually I would like to test this first locally atleast, since there are no tests by the looks of it. |
I'd be happy to add tests if there's already somewhere with tests of the REPL? |
I expected the cpython test-suite to have repl tests, but it doesn't. We don't really need tests I suppose. |
@arihant2math just to confirm is there anything you need from me to proceed with review? I've got some other patches I'm working on to make this work more generally, and to also enable |
LGTM. |
I am sorry. Just distracted a bit by recent CI trouble. The patch looks good |
@aneeshdurg Instead of sending patch based on main branch, you can create new branch as many as you want. That helps to create multiple patches at same time. |
I fixed comment of codeop.py a bit. |
Thank you for contributing! |
This makes it possible to define functions/classes interactively.