Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-38673: dont switch to ps2 if the line starts with comment or whitespace #17421
Conversation
This comment has been minimized.
This comment has been minimized.
The patch fixes the issue on master on Windows. I can't tell if this is the best fix or if there could be an issue not caught in the tests. |
I'm not sure that this is the right approach yet. While you prevent the prompt from changing to "...", the code still keeps accumulating input, which means the line count will be off. Example:
I suspect you may have to doctor the caller of |
…espace
This comment has been minimized.
This comment has been minimized.
Thanks for suggestions @gvanrossum, current version fixed accumulation bug. |
if (tok->nextprompt != NULL) | ||
tok->prompt = tok->nextprompt; | ||
if (tok->nextprompt != NULL) { | ||
if (newtok != NULL && (*newtok == '#' || *newtok == ' ' || *newtok == '\t')) |
This comment has been minimized.
This comment has been minimized.
if (tok->nextprompt != NULL) { | ||
if (newtok != NULL && (*newtok == '#' || *newtok == ' ' || *newtok == '\t')) | ||
tok->nextprompt = NULL; | ||
else |
This comment has been minimized.
This comment has been minimized.
Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst
Outdated
Show resolved
Hide resolved
if (tok->nextprompt != NULL) | ||
tok->prompt = tok->nextprompt; | ||
if (tok->nextprompt != NULL) { | ||
if (newtok != NULL && (*newtok == '#' || *newtok == ' ' || *newtok == '\t')) |
This comment has been minimized.
This comment has been minimized.
pablogsal
Dec 2, 2019
Member
Suggestion: You may be able to simplify this with strchr
(check that is not slower....maybe is faster if inlined).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Left some comment regarding the code itself, I didn't check the solution itself yet. |
This comment has been minimized.
This comment has been minimized.
(I am working through a backlog, I should pay attention to reviews and other tasks that have been waiting longer first.) |
Better, but there's still a regression. Look here:
Previously this would just give a
|
This comment has been minimized.
This comment has been minimized.
I think it works now but i am not sure if it is an ideal solution or not. |
I have to think about this more. It seems to work but the changes look ad-hoc (and not at all what I had expected they would be when I wrote up the bug description). I need to do some deep thinking about whether this is the right place in the code to implement this behavior. Ping me if I haven't replied in a week -- I don't want to keep you hanging forever! |
This comment has been minimized.
This comment has been minimized.
I have a different suggestion:
|
This comment has been minimized.
This comment has been minimized.
Thanks for your suggestions Guido. |
LGTM. Can one of the other reviewers double-check there's nothing amiss? |
This comment has been minimized.
This comment has been minimized.
The 2 error cases on the issue and 2 above and otherw work for me. I presume
is correct. |
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Dec 9, 2019
Thanks @isidentical for the PR |
…espace (pythonGH-17421) https://bugs.python.org/issue38673 (cherry picked from commit 109fc27) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Dec 9, 2019
GH-17516 is a backport of this pull request to the 3.8 branch. |
…espace (GH-17421) https://bugs.python.org/issue38673 (cherry picked from commit 109fc27) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
…espace (pythonGH-17421) https://bugs.python.org/issue38673 (cherry picked from commit 109fc27) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com> (cherry picked from commit 184a381) Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
…espace (GH-17421) (GH-17522) https://bugs.python.org/issue38673 (cherry picked from commit 109fc27) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
isidentical commentedNov 30, 2019
•
edited by miss-islington
https://bugs.python.org/issue38673
Automerge-Triggered-By: @gvanrossum