fea8cf8 fix: use 'is None' instead of '== None' in socket handler
📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝backend/open_webui/socket/main.py (+1 -1)
📄 Description
Summary
Replace equality comparison with identity check for None value in socket message handler.
Changes
data.get("type") == None → data.get("type") is None
Why
According to PEP 8, comparisons to singletons like None should always be done with is or is not, never the equality operators == or !=.
This is because:
Identity checks (is) are faster than equality checks (==)
None is a singleton, so identity comparison is semantically correct
Using == can lead to unexpected behavior if a class overrides __eq__
Test plan
Existing tests should pass. This is a code quality improvement that maintains identical behavior.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/21437
**Author:** [@aviu16](https://github.com/aviu16)
**Created:** 2/15/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix-none-comparison`
---
### 📝 Commits (1)
- [`fea8cf8`](https://github.com/open-webui/open-webui/commit/fea8cf896d8b4a2ab86af5097c1775d994a6d39b) fix: use 'is None' instead of '== None' in socket handler
### 📊 Changes
**1 file changed** (+1 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/socket/main.py` (+1 -1)
</details>
### 📄 Description
## Summary
Replace equality comparison with identity check for None value in socket message handler.
## Changes
- `data.get("type") == None` → `data.get("type") is None`
## Why
According to [PEP 8](https://peps.python.org/pep-0008/#programming-recommendations), comparisons to singletons like `None` should always be done with `is` or `is not`, never the equality operators `==` or `!=`.
This is because:
1. Identity checks (`is`) are faster than equality checks (`==`)
2. `None` is a singleton, so identity comparison is semantically correct
3. Using `==` can lead to unexpected behavior if a class overrides `__eq__`
## Test plan
Existing tests should pass. This is a code quality improvement that maintains identical behavior.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21437
Author: @aviu16
Created: 2/15/2026
Status: ❌ Closed
Base:
main← Head:fix-none-comparison📝 Commits (1)
fea8cf8fix: use 'is None' instead of '== None' in socket handler📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/open_webui/socket/main.py(+1 -1)📄 Description
Summary
Replace equality comparison with identity check for None value in socket message handler.
Changes
data.get("type") == None→data.get("type") is NoneWhy
According to PEP 8, comparisons to singletons like
Noneshould always be done withisoris not, never the equality operators==or!=.This is because:
is) are faster than equality checks (==)Noneis a singleton, so identity comparison is semantically correct==can lead to unexpected behavior if a class overrides__eq__Test plan
Existing tests should pass. This is a code quality improvement that maintains identical behavior.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.