classification
Title: Running print("\x98") then freeze in Interpreter
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
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 2018-11-19 15:45 by pmpp. This issue is now closed.

Messages (7)
msg330076 - (view) Author: (otst) Date: 2018-11-19 07:45
My environment
OS:Ubuntu18.04(x64)
Python:3.6.6


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.

results:
1542621412.508629 (stop. Control+D later)˜ 1542621412.5086305
1542621412.5087285
>>> 
KeyboardInterrupt
>>> 



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



'\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:
SHIFT_JIS
ISO-2022-KR
IBM850
GBK



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.

but:

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
print("\x98")
with open("x", "w") as fp:
    fp.write("done\n")
    fp.flush()
print("wait")
time.sleep(5)
print("exit")

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
History
Date User Action Args
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