-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Closed
Copy link
Labels
topic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
C:\Users\Admin\Downloads\python-3.13.0-embed-amd64>python
Python 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
>>> for i in range(5):
... # a comment goes here
... # now the repl indents to here
... # then here
... print(i)
...
0
1
2
3
4
>>>
>>> for i in range(5):
... print(i)
... # now put a comment here
... # no problem
...
0
1
2
3
4
>>>
>>> if i==4:
... # comment here
... #it indented to here
... print("yes")
... else:
... print("no")
...
yes
>>>
>>> def even_or_odd(num):
... # comment here
... #it indents too far
... print("calculating...")
... return 'eovdedn'[num % 2::2]
...
>>>
>>> for num in [0, 1, 2, 3, 4, 5, 100, 100000000, 1000000000000005]:
... # comment here
... #indents too far
... print(f"{num} is {even_or_odd(num)}")
...
calculating...
0 is even
calculating...
1 is odd
calculating...
2 is even
calculating...
3 is odd
calculating...
4 is even
calculating...
5 is odd
calculating...
100 is even
calculating...
100000000 is even
calculating...
1000000000000005 is odd
>>>
I apologize if this has already been brought up, I couldn't find it.
The issue: In the new 3.13.0 REPL, if you open a loop, function, if statement, or anything that requires indentation, and then start the next line with a comment, it indents extra spaces.
I have a few examples above.
My PC: Windows 11
python version: 3.13.0
Steps to reproduce:
- Download an install python 3.13.0 and open the python repl.
- start a for loop and press enter : E.G.
for i in range(5):
- start the next line with a comment and press enter: E.G.
# My comment here
- it will indent another level which is too far
Thank you so much everyone for python development and I hope I explained the issue clearly.
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
topic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error