Closed
Description
Describe the bug
bool(web.Response()) evaluates to False. I suspect this is because Response inherits from MutableMapping.
This may cause confusion when checking for if response: instead of if response is not None.
To Reproduce
>>> response = web.Response()
>>> bool(response)
False
>>> response["a"] = 1
>>> bool(response)
True
Expected behavior
I personally think Response should always be "truthy".
Logs/tracebacks
N/APython Version
3.13.0aiohttp Version
3.11.9multidict Version
6.1.0propcache Version
0.2.0yarl Version
1.17.1OS
Fedora 41
Related component
Server, Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct