Skip to content

Interactive Mode suddenly prevents indexing "[]" #134095

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

Closed
alex77g2 opened this issue May 16, 2025 · 11 comments
Closed

Interactive Mode suddenly prevents indexing "[]" #134095

alex77g2 opened this issue May 16, 2025 · 11 comments
Labels
OS-windows stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@alex77g2
Copy link

alex77g2 commented May 16, 2025

Bug report

Bug description:

import numpy as np
m = np.arange(16).reshape(4,4)
s = "m[1]" # see text below
m[1]  # array([4, 5, 6, 7])

The code above works as expected in Python 3.12 (file.py + interactive mode) and Python 3.13 (from file.py).
But it fails in Interactive Mode (console), at least under Windows 10.
Running same code from file.py works ( "print(m[1])" ).
Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32
It is nearly impossible to enter "m[1]". If testing Console of 3.12 it is fine. Console 3.13 is broken.
Reopen and retry does not fix it. After some time trying, I got it only once via entering strings "[1]" and removing string limiters '"'. If code is somehow entered, it works, but usually it is impossible to enter now.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

@alex77g2 alex77g2 added the type-bug An unexpected behavior, bug, or error label May 16, 2025
@alex77g2
Copy link
Author

I use python console mode every week and I like it. Yesterday, I started using Python 3.13 after 1 year daily using Python 3.12 under Windwos and Ubuntu/Linux. I would see me as an educated power user.

@ZeroIntensity ZeroIntensity added topic-repl Related to the interactive shell and removed OS-windows labels May 16, 2025
@chris-eibl
Copy link
Member

Maybe a duplicate of #132439?

@alex77g2
Copy link
Author

alex77g2 commented May 16, 2025

Maybe a duplicate of #132439?

I can confirm, that I also have german keyboard layout (as in the suggested duplicate).
I can also confirm, that it affects {} and [] but not () . This is in line with duplicate suggestion.
I found, that entering "[" many times helps sometimes, but then the closing one "]" is impossible.

@alex77g2
Copy link
Author

alex77g2 commented May 16, 2025

Another note: we do not need numpy, list indexing is enough.

a = (1,2,3,4)
s = "a[1]" # sometimes possible after hard trying
a[1] # 2

Pressing "[" many time allows for a single "[" char. "[[[[" e.g. gives "[", if you open multiple visible ones, closing a single one is often possible, but only one closing "]". Is there some counting inside, that is intended to avoid unmatched [] or {} ???
I tried on another german Windows computer and it still fails.

@picnixz picnixz added the stdlib Python modules in the Lib dir label May 16, 2025
@StanFromIreland
Copy link
Contributor

I can confirm

You confirmed this is a duplicate. The fix was not backported, are there plans to do so? Discussion on weather it should be should continue on the pr, not here.

@chris-eibl
Copy link
Member

Fixed in 3.14 beta 1 and also backported to 3.13. Will be in the upcoming 3.13.4. I think we can close here?

@alex77g2
Copy link
Author

Fixed in 3.14 beta 1 and also backported to 3.13. Will be in the upcoming 3.13.4. I think we can close here?

OK, closing. A final question: are there nightly builds with the fix available?

@chris-eibl
Copy link
Member

3.14 b1 can be downloaded from python.org

@chris-eibl
Copy link
Member

AFAIR, 3.13.2 did not have the bug, so this might be another option from python.org

@chris-eibl
Copy link
Member

Or just disable the new REPL using the environment variable PYTHON_BASIC_REPL=1.

@alex77g2
Copy link
Author

Or just disable the new REPL using the environment variable PYTHON_BASIC_REPL=1.

rhis helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

7 participants