-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
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/A
Python Version
3.13.0
aiohttp Version
3.11.9
multidict Version
6.1.0
propcache Version
0.2.0
yarl Version
1.17.1
OS
Fedora 41
Related component
Server, Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct