You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
typing.py has an incorrect definition of closed #83674
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-01-30.06:00:37.441>created_at=<Date2020-01-30.00:37:07.981>labels= ['3.8']
title='typing.py has an incorrect definition of closed'updated_at=<Date2020-01-30.06:00:37.440>user='https://github.com/hauntsaninja'
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.
Activity
hauntsaninja commentedon Jan 30, 2020
Hello!
typing.py has the following definition of
closed:https://github.com/python/cpython/blob/master/Lib/typing.py#L1834
This is inconsistent with the behaviour at runtime:
It seems like the right thing to do is add an @Property, as we do with e.g.
modeandname. 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!
gvanrossum commentedon Jan 30, 2020
New changeset 2e6569b by Shantanu in branch 'master':
bpo-39493: Fix definition of IO.closed in typing.py (bpo-18265)
2e6569b
miss-islington commentedon Jan 30, 2020
New changeset 58076df by Miss Islington (bot) in branch '3.8':
bpo-39493: Fix definition of IO.closed in typing.py (GH-18265)
58076df
gvanrossum commentedon Jan 30, 2020
New changeset 194c7ae by Miss Islington (bot) in branch '3.7':
[3.7] bpo-39493: Fix definition of IO.closed in typing.py (GH-18273)
194c7ae
gvanrossum commentedon Jan 30, 2020
Thanks, Shantanu!