Fix #11334: Cannot make multi-line code blocks in ipython by bxsx · Pull Request #11354 · ipython/ipython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation7 Commits6 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
When codeop.compile_command() returns None it actually says "at least
some part of the code was compiled successfully" which is not really important
for checking if it's complete or not.
Once we haven't got any errors during compilation process, we just want
to check if there will be another nested block of code or not by checking
a colon.
When codeop.compile_command() returns None it actually says "at least some part of the code was compiled successfully" which is not really important for checking if it's complete or not. Once we haven't got any errors during compilation process, we just want to check if there will be another nested block of code or not by checking a colon.
bxsx mentioned this pull request
That seem incorrect, now a = 1
is considered as incomplete, while it's not.
Yeah, I have already fixed it. Trying to run a test suit locally but I get a lot of errors and unfortunately can't understand why (is there any dev-guide how to develop ipython locally?).
Anyway, I'm pushing the fix, to see what CI will say...
That seem incorrect, now
a = 1
is considered as incomplete, while it's not.
Seems it's OK now
There seem to be some more edge cases:
Appear as incomplete and adds a new line with 4 spaces.
Appear as complete an executes.
I am very busy today but this looks like an another bug to me that we haven't noticed before because of this bug.
If there is at least one space in the last line (blank) then the line is complete.
if True:
1
<at least 1 space>
this seem to work correctly.
The bug is in a code before check_complete()
is being called as it's already missed in the cell
argument passed to the function.
I can take a look in it closer but not before weekend.
InteractiveShell.check_complete()
invokes TransferManager.check_complete()
and seems the passing code
argument doesn't have a trailing '\n' in any situation. I believe this is for some reasons and is correct, @Carreau ?
If so, this helped me to focus back to the TransferManager.check_complete()
and seems like removing the condition fixes the issue but provides a regression in another test. This actually surprised me honestly.
Going off for a day or two, leaving the comment for notes, but feel free to share some information if you have or finish the fix obviously ;-)
PS. @Carreau is there any guide how to develop and test locally IPython? When I want to use IPython installed globally (to meet all requirements etc.) I have no access to the IPython-dev directory as all imports are already done for starting IPython itself. I can figure it out how to do this but maybe there is a note about it somewhere?
InteractiveShell.check_complete()
invokesTransferManager.check_complete()
and seems the passingcode
argument doesn't have a trailing '\n' in any situation. I believe this is for some reasons and is correct, @Carreau ?
@takluyver wrote most of this,
PS. @Carreau is there any guide how to develop and test locally IPython? When I want to use IPython installed globally (to meet all requirements etc.) I have no access to the IPython-dev directory as all imports are already done for starting IPython itself. I can figure it out how to do this but maybe there is a note about it somewhere?
Clone the repo and run pip install -e .
that should make a dev install that reflect modification to the source code.
I use cd ; iptest IPython.core.tests.test_inputtransformer2:test_check_complete; cd -
to run a single test, and be sure not to be in IPython source tree when running the test.
https://github.com/ipython/ipython#development-and-instant-running is basically links to longer versions than this.
If I have time outside of $DAYJOB I'll try have a look, but @takluyver is the expert, and @tonyfast sent a PR to fix another bug recently so may have some insights.
Labels
you want to participate to hacktoberfest ? Here is an easy issue.
2 participants