pythonpython-3.xsysbpython

sys.stdout does not have attribute flush in bpython


I am using bpython for interactive Python sessions and since I updated my system I have the following problem:

In bpython3:

>>> import sys
>>> sys.stdout.flush
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'FakeStream' object has no attribute 'flush'

However, in Python3:

>>> import sys
>>> sys.stdout.flush
<built-in method flush of _io.TextIOWrapper object at 0x7fab6b7fb708>

The same for IPython3.

So why does sys.stdout not have the attribute flush in bpython3? I searched for the source code of the sys module, but couldn't find it. Nor could I find a sysmodule.c file or something like that. Doesn't bpython use the same code for this module as the other CLIs?

$ bpython3 --version
bpython version 0.12 on top of Python 3.4.2
(C) 2008-2012 Bob Farrell, Andreas Stuehrk et al. See AUTHORS for detail.

$ python3 --version
Python 3.4.2

Solution

  • It is a bug that was fixed in version 0.13.

    Upgrading with pip3 install -U bpython should update to the latest stable release which includes the fix.