-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configparser.ConfigParser.values()
should return a ValuesView[configparser.SectionProxy]
#11547
Comments
I don't know the exact underlying problem, but in the stub we mimic the implementation by overriding |
It isn't. The issue is that for purposes of setting values, any See the implementation of these two methods on
I suspect that the solution is to, in the stub, override |
Consider these two similar python programs, which have identical behavior:
and
(The only difference between the two programs is invoking
cparser.items()
orcparser.values()
)The first program type-checks in
mypy
without any issues, but the second program:The problem is that
ConfigParser
objects accept assignment of arbitrarystr
->str
mappings but when you pull a value back out of aConfigParser
, the value pulled out is always aconfigparser.SectionProxy
. (see the__getitem__
and__setitem__
methods onconfigparser.RawConfigParser
)Note that this affects not only the return type of
values
but also the return type of__getitem__
; it should be perfectly well-typed to writecparser[some_str_value].name
.The text was updated successfully, but these errors were encountered: