Author hauntsaninja
Recipients hauntsaninja
Date 2020-01-30.00:37:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580344628.01.0.169235800927.issue39493@roundup.psfhosted.org>
In-reply-to
Content
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!
History
Date User Action Args
2020-01-30 00:37:08hauntsaninjasetrecipients: + hauntsaninja
2020-01-30 00:37:08hauntsaninjasetmessageid: <1580344628.01.0.169235800927.issue39493@roundup.psfhosted.org>
2020-01-30 00:37:07hauntsaninjalinkissue39493 messages
2020-01-30 00:37:07hauntsaninjacreate