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
We currently claim that dict.__(r)or__ accepts any Mapping, but this isn't actually true. At runtime, the object passed to dict.__or__ has to be an instance of dict (and requests.structures.CaseInsensitiveDict is not a subclass of dict).
Ideally we'd make this change, but I think we tried it recently, and it caused an unfortunate number of false positives:
Activity
AlexWaygood commentedon Sep 7, 2023
In actual fact, the issue is our stubs for
dict.__or__anddict.__ror__:typeshed/stdlib/builtins.pyi
Lines 1122 to 1129 in aa39b99
We currently claim that
dict.__(r)or__accepts anyMapping, but this isn't actually true. At runtime, the object passed todict.__or__has to be an instance ofdict(andrequests.structures.CaseInsensitiveDictis not a subclass ofdict).Ideally we'd make this change, but I think we tried it recently, and it caused an unfortunate number of false positives:
[-]No error for [/-][+]False negatives with `dict.__(r)or__`[/+]AlexWaygood commentedon Sep 7, 2023
Okay, making the type hints more accurate here is actually less disruptive than I thought it would be! See #10679 (comment)
adamtheturtle commentedon Sep 7, 2023
Thank you for picking this up so quickly.
sobolevn commentedon Oct 11, 2023
AlexWaygood commentedon Oct 12, 2023
AlexWaygood commentedon Oct 12, 2023
sobolevn commentedon Oct 18, 2023