You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've discovered a bug with the tokenizer and automatic forward-slash-parenthesization.
Specifically, the following will result in an error when run in IPython 8.25.0 on Python 3.12.3:
1| from pathlib import Path
2|
3| (
4| Path(".")
5| / f")"
6| / "a a a a a a a a a"
7| )
Interestingly, the issue is mitigated if the f-string on line 5 is:
removed/replaced by a plain string
has any character after the ending parenthesis
starts with an opening parenthesis (note if there's anything before, including a space, it'll fail)
From a little digging, the tokenizer starts a new line (in tokens_by_line) when it encounters the new line at the end of the f-string.
It looks like the end parenthesis in the f-string is becoming an FSTRING_MIDDLE token, and deincrementing parenlev.
"`make_tokens_by_line` received a list of lines which do not have lineending markers ('\\n', '\\r', '\\r\\n', '\\x0b', '\\x0c'), behavior will be unspecified",
Hey there!
I've discovered a bug with the tokenizer and automatic forward-slash-parenthesization.
Specifically, the following will result in an error when run in IPython 8.25.0 on Python 3.12.3:
Interestingly, the issue is mitigated if the f-string on line 5 is:
From a little digging, the tokenizer starts a new line (in
tokens_by_line
) when it encounters the new line at the end of the f-string.It looks like the end parenthesis in the f-string is becoming an
FSTRING_MIDDLE
token, and deincrementingparenlev
.See here
ipython/IPython/core/inputtransformer2.py
Lines 511 to 556 in 1b4607f
This issue does not occur on an older version of Python (e.g., 3.11.x), even when running the latest version of IPython.
The text was updated successfully, but these errors were encountered: