Edgewall Software

Opened 12 years ago

Last modified 11 years ago

#10768 closed defect

`format_datetime` calls `locale.getpreferredencoding()` which is NOT thread-safe — at Initial Version

Reported by: Jun Omae Owned by:
Priority: normal Milestone: 0.12.5
Component: general Version: 0.12
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

format_datetime function in trac.util.datefmt calls locale.getpreferredencoding() which is NOT thread-safe.

On some systems, it is necessary to invoke setlocale() to obtain the user preferences, so this function is not thread-safe. If invoking setlocale is not necessary or desired, do_setlocale should be set to False. From http://docs.python.org/library/locale.html#locale.getpreferredencoding

I think we should call locale.getpreferredencoding() on ahead and cache the retrieved value.

repos:jomae.git:ticket10768/cached-pref-encoding/0.12-stable

Change History (0)

Note: See TracTickets for help on using tickets.