[issue9548] locale can be imported at startup but relies on too many library modules
report at bugs.python.org
Wed Aug 11 10:07:42 CEST 2010
Marc-Andre Lemburg <mal at egenix.com> added the comment:
Antoine Pitrou wrote:
> Antoine Pitrou <pitrou at free.fr> added the comment:
>> I said "warn about the use of non-builtin modules", not disallow
>> their use. AFAIK, the purpose of the exercise is to reduce the
>> number of non-builtin modules being loaded early on during
>> Python startup.
> The purpose of the exercise is to avoid, as much as possible, the
> numerous issues that have already been encountered because of the
> startup procedure relying on locale in various conditions for
> initialization of the standard streams.
> You are proposing that we commit a one-time fix to fix the current
> situation. Recent history shows that similar problems will arise again,
> and waste useful developer time for committing urgency fixes in order to
> fix the build (not to mention that the symptoms are sometimes difficult
> to diagnose, such as in this very issue). I am proposing a broader
> change which prevents, as much as possible, similar problems from
> reappearing and will relieve us from a dispensable burden.
No, what I'm proposing is to make "import locale" safe during
boot time. By separating out some functions into a separate
module which is then supposed to be used by the boot process,
you don't really solve the problem. Other code in the boot process
may very well still import the main locale module and thus
cause the same problems you were trying to solve by separating
out the problematic code - even if this is just code that gets
run via sitecustomize.py or other such hooks.
The changes I'm suggesting will be beneficial to all
standard uses of the module without any such workarounds
based on conventions.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list