New submission from Shantanu <hauntsani...@gmail.com>:
Hello! typing.py has the following definition of `closed`: https://github.com/python/cpython/blob/master/Lib/typing.py#L1834 ``` @abstractmethod def closed(self) -> bool: pass ``` This is inconsistent with the behaviour at runtime: ``` In [17]: sys.version Out[17]: '3.8.1 (default, Jan 23 2020, 23:36:06) \n[Clang 11.0.0 (clang-1100.0.33.17)]' In [18]: f = open("test", "w") In [19]: f.closed Out[19]: False ``` It seems like the right thing to do is add an @property, as we do with e.g. `mode` and `name`. I'll submit a PR with this change. Note typeshed also types this as a property to indicate a read-only attribute. https://github.com/python/typeshed/blob/master/stdlib/3/typing.pyi#L459 First time filing a bug on BPO, thanks a lot in advance! ---------- messages: 360996 nosy: hauntsaninja priority: normal severity: normal status: open title: typing.py has an incorrect definition of closed versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39493> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com