bpython doesn't show output after utf-8 default encoding
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bpython (Ubuntu) |
Invalid
|
Undecided
|
Finn Årup Nielsen |
Bug Description
Binary package hint: bpython
After "sys.setdefault
>>> print(1)
1
>>> import sys
>>> reload(sys)
>>> sys.setdefaulte
>>> print(2)
>>>
Here "2" is missing. I believe this behavior is a bug. In standard 'python' you will get:
>>> print(1)
1
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.setdefaulte
>>> print(2)
2
>>>
Description: Ubuntu 10.04.1 LTS
Release: 10.04
bpython:
Installeret: 0.9.5.2-2ubuntu1
Kandidat: 0.9.5.2-2ubuntu1
Versionstabel:
*** 0.9.5.2-2ubuntu1 0
500 http://
100 /var/lib/
This has nothing to do with sys.setdefaulte ncoding( ), it's because the sys module is reloaded. bpython sets sys.stdout, sys.stderr and sys.stdin to its own objects (needed because of the use of curses), but the reload of sys resets those attributes back to its original values.
I don't really agree that it is a bug. Either don't reload sys or save the values of sys.stdin, sys.stderr and sys.stdout and set them again after the reload.