This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Running print("\x98") then freeze in Interpreter
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: otst, pmpp, steven.daprano, vstinner
Priority: normal Keywords:

Created on 2018-11-19 07:45 by otst, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg330076 - (view) Author: (otst) Date: 2018-11-19 07:45
My environment

Run print("\x98") in Python3 interpreter then freeze or slow responsed.

Not problem run print '\x98' in Python 2.7.15rc1.

Also no problem for python3 -c "print('\x98');" and run .py file.
msg330078 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-11-19 08:30
I'm afraid I can't reproduce that in Python 3.5.2 or 3.6.4.

Can you try this?

from time import time
print(time(), '\x98', time()); print(time())

and copy and paste the results.

What terminal/console are you using? If you change to a different console, does the problem go away?
msg330088 - (view) Author: (otst) Date: 2018-11-19 11:36
I used GNOME Terminal 3.28.2.

I tried advised code Gnome Terminal and LXTerminal 0.3.1.
but stop after first time() function.

1542621412.508629 (stop. Control+D later)˜ 1542621412.5086305

Tried change '\x98' to '\x97' results:
1542621365.7332687  1542621365.73327

'\x97' is no problem. Perhaps the encoding may be affecting it.
I used UTF-8 on the terminal. I changed the SHIFT_JIS and tried print('\x98'), but it did not stop.

As a result of trying a little, what was okay:

Also, I am Japanese and my computer is in Japanese environment.
msg330102 - (view) Author: pmp-p (pmpp) * Date: 2018-11-19 15:16
hi i can reproduce with a ubuntu bionic or mint19 client toward a python3.4.3 reached via ssh server:

 - via mate-terminal or terminator  :

same behaviour as OP report

 - meanwhile using the same python3 directly via vnc + xterm gives :

pm / # python3
Python 3.4.3 (default, Nov 12 2018, 22:25:49) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print( chr(152) )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\x98' in position 0: ordinal not in range(128)
msg330104 - (view) Author: pmp-p (pmpp) * Date: 2018-11-19 15:22
LC_ALL=en_US.UTF-8  on the ssh line is the culprit
unset LC_ALL , gives same lockup result.


LC_ALL=C give sames results as vnc, where no locale was set.
msg330105 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-19 15:30
I can reproduce the issue on Fedora 29 in gnome-terminal.

Python is not blocked at all. It's just your terminal which stops displaying new strings. Try:

import time
with open("x", "w") as fp:

And see file "x" created even after print("\x98").

Sorry, I'm not interested to investigate the terminal behavior.
msg330106 - (view) Author: pmp-p (pmpp) * Date: 2018-11-19 15:45
anything not using "libvte" is fine 
i suggest you try "mlterm" a very good multilingual terminal
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79455
2018-11-19 15:45:48pmppsetmessages: + msg330106
2018-11-19 15:30:15vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg330105

resolution: not a bug
stage: resolved
2018-11-19 15:22:45pmppsetmessages: + msg330104
2018-11-19 15:16:41pmppsetnosy: + pmpp
messages: + msg330102
2018-11-19 11:36:24otstsetmessages: + msg330088
2018-11-19 08:30:27steven.dapranosetnosy: + steven.daprano
messages: + msg330078
2018-11-19 07:45:59otstcreate