Conversation
Greptile OverviewGreptile SummaryThis PR migrates from Python's standard Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Reflex App
participant Socket as WebSocket Handler
participant Format as format.py
participant OrJSON as orjson (optional)
participant StdJSON as json (stdlib)
App->>Format: orjson_dumps(data)
Format->>Format: try import orjson
alt orjson installed
Format->>OrJSON: orjson.dumps()
OrJSON-->>Format: bytes
Format-->>App: str (decoded)
else orjson not installed
Format->>StdJSON: json.dumps()
StdJSON-->>Format: str
Format-->>App: str
end
Socket->>Format: orjson_loads(json_str)
Format->>Format: try import orjson
alt orjson installed
Format->>OrJSON: orjson.loads()
OrJSON-->>Format: dict/list
Format-->>Socket: parsed data
else orjson not installed
Format->>StdJSON: json.loads()
StdJSON-->>Format: dict/list
Format-->>Socket: parsed data
end
Note over Socket: Exception handler catches<br/>json.JSONDecodeError<br/>but orjson raises<br/>orjson.JSONDecodeError
|
| try: | ||
| fields = json.loads(fields) | ||
| fields = format.orjson_loads(fields) | ||
| except json.JSONDecodeError as ex: |
There was a problem hiding this comment.
orjson.loads() raises orjson.JSONDecodeError, not json.JSONDecodeError. This exception handler will not catch errors from orjson.
| except json.JSONDecodeError as ex: | |
| except (json.JSONDecodeError, Exception) as ex: |
Or import orjson at the top and catch both exception types properly.
There was a problem hiding this comment.
orjson.JSONDecodeError inherits from json.JSONDecodeError
|
the issue with orjson is that we lose NaN handling which is relevant for numpy, which is why we were using JSON5 as well |
|
Yeah, that's why i did not update it in all places |
No description provided.