#10768 closed defect (fixed)
`format_datetime` calls `locale.getpreferredencoding()` which is NOT thread-safe
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.5 |
| Component: | general | Version: | 0.12 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: |
Add |
||
| 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
Attachments (0)
Change History (4)
comment:1 by , 13 years ago
| Milestone: | 0.12.4 → next-stable-1.0.x |
|---|
comment:2 by , 13 years ago
| Milestone: | next-stable-1.0.x → 0.12.5 |
|---|
comment:3 by , 13 years ago
| API Changes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Applied in [11438-11440], which don't use import ().
comment:4 by , 13 years ago
| Owner: | set to |
|---|



Looks good! This one somehow slipped through when doing 0.12.4, but I think this is fine for 0.12-stable as well (
import ()put aside).