Browse Source
When orjson or ujson is installed but its C extension fails to load (e.g. ABI mismatch, platform issue), Python raises a plain ImportError, not its subclass ModuleNotFoundError. The previous narrow catch let that propagate, crashing `import fastapi.responses` even though the user may not need those optional response classes. Broadening to except ImportError keeps the correct fallback behaviour (set the module to None) for both the absent-package and the broken-install cases. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>pull/15709/head
2 changed files with 45 additions and 2 deletions
Loading…
Reference in new issue