Re: [PATCH 10/11] scripts: sphinx-*: prevent sphinx-build crashes
From: Jonathan Corbet
Date: Thu Aug 21 2025 - 15:41:41 EST
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> writes:
> + # The sphinx-build tool has a bug: internally, it tries to set
> + # locale with locale.setlocale(locale.LC_ALL, ''). This causes a
> + # crash if language is not set. Detect and fix it.
> + try:
> + locale.setlocale(locale.LC_ALL, '')
> + except Exception:
> + self.env["LC_ALL"] = "C"
> + self.env["LANG"] = "C"
In my years of writing Python, one of the most insidious things I have
encountered is this sort of wild-card catch; it can hide all kinds of
bugs. There must be a specific exception you can catch here?
Thanks,
jon