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 commented on Sep 7, 2023
In actual fact, the issue is our stubs for dict.__or__ and dict.__ror__:
typeshed/stdlib/builtins.pyi
Lines 1122 to 1129 in aa39b99
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:
AlexWaygood commented on 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 commented on Sep 7, 2023
Thank you for picking this up so quickly.
sobolevn commented on Oct 11, 2023
AlexWaygood commented on Oct 12, 2023
AlexWaygood commented on Oct 12, 2023
sobolevn commented on Oct 18, 2023