sys.stdout 在 bpython 中没有属性 flush

sys.stdout does not have attribute flush in bpython

我正在使用 bpython 进行交互式 Python 会话,自从我更新了系统后,我遇到了以下问题:

在 bpython3 中:

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

然而,在 Python3:

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

IPython3也一样。

那么为什么sys.stdout在bpython3中没有属性flush呢?我搜索了 sys 模块的源代码,但没有找到。我也找不到 sysmodule.c 文件或类似的文件。 bpython 是否为此模块使用与其他 CLI 相同的代码?

$ 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

这是一个错误,已在版本 0.13 中修复。

使用 pip3 install -U bpython 升级应该更新到包含修复的最新稳定版本。