I just downloaded the latest Git Bash (2.36.1 64-bit) and installed Python 10. I'm running Windows 11. Among a couple of other unexpected changes from my earlier setup using a previous version of Git Bash and mostly running Python 3.9 (i.e. I now have to run python -i
for the interactive python interpreter, for all 2.x and 3.x versions, instead of just running python
), the most frustrating is that ctrl+z
followed by Enter
no longer quits from the interpreter. Instead I must call exit()
. Ex:
user@User MINGW64 ~
$ python -i
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # ctrl+z, Enter pressed here
File "<stdin>", line 1
^
SyntaxError: invalid syntax
>>> exit()
user@User MINGW64 ~
$
The same is true for my other installations of python 3 (3.7, 3.8, 3.9), but python 2.7 still has the expected behavior:
user@User MINGW64 ~
$ $PYTHON\\Python27\\python -i
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # ctrl+z, Enter pressed here
user@User MINGW64 ~
$
What I've tried
I've done quite a bit of research but can't figure out what may have changed. In the earlier version of Git Bash, I remember that ^Z
, ^X
, ^C
, and ^V
characters (and maybe more) would display explicitly in the console when typed. Curiously, pressing ctrl+c
followed by Enter
comes with the error message below. Did some sort of character encoding change in the newer versions of Git Bash?
user@User MINGW64 ~
$ python
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # ctrl+c, Enter pressed here
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 14, in decode
def decode(self,input,errors='strict'):
KeyboardInterrupt
The above exception was the direct cause of the following exception:
KeyboardInterrupt: decoding with 'cp1252' codec failed (KeyboardInterrupt: )
>>>
I am too lazy to constantly type exit()
. How can I restore the functionality where pressing ctrl+z
, then Enter
quits the interpreter for my python 3 versions?