Blame SOURCES/0001-Do-not-traceback-when-calling-setlocale-875354.patch
|
|
47a405 |
From a43c9ca4e0fb600d425f50d11287f7c4fddee5f3 Mon Sep 17 00:00:00 2001
|
|
|
47a405 |
From: Chris Lumens <clumens@redhat.com>
|
|
|
47a405 |
Date: Fri, 14 Dec 2012 13:06:43 -0500
|
|
|
47a405 |
Subject: [PATCH 01/03] Do not traceback when calling setlocale (#875354).
|
|
|
47a405 |
|
|
|
47a405 |
This is just a debugging luxury. It's not worth additional tracebacks.
|
|
|
47a405 |
---
|
|
|
47a405 |
src/parted/decorators.py | 13 +++++++++++--
|
|
|
47a405 |
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
47a405 |
|
|
|
47a405 |
diff --git a/src/parted/decorators.py b/src/parted/decorators.py
|
|
|
47a405 |
index 2b583ad..737f72c 100644
|
|
|
47a405 |
--- a/src/parted/decorators.py
|
|
|
47a405 |
+++ b/src/parted/decorators.py
|
|
|
47a405 |
@@ -24,13 +24,22 @@ import locale
|
|
|
47a405 |
import functools
|
|
|
47a405 |
|
|
|
47a405 |
def localeC(fn):
|
|
|
47a405 |
+ # setlocale is not thread-safe, and anaconda (at least) may call this from
|
|
|
47a405 |
+ # another thread. This is just a luxury to have untranslated tracebacks,
|
|
|
47a405 |
+ # so it's not worth tracebacking itself.
|
|
|
47a405 |
+ def _setlocale(l):
|
|
|
47a405 |
+ try:
|
|
|
47a405 |
+ locale.setlocale(locale.LC_MESSAGES, l)
|
|
|
47a405 |
+ except:
|
|
|
47a405 |
+ pass
|
|
|
47a405 |
+
|
|
|
47a405 |
@functools.wraps(fn)
|
|
|
47a405 |
def new(*args, **kwds):
|
|
|
47a405 |
oldlocale = locale.getlocale(locale.LC_MESSAGES)
|
|
|
47a405 |
- locale.setlocale(locale.LC_MESSAGES, 'C')
|
|
|
47a405 |
+ _setlocale('C')
|
|
|
47a405 |
try:
|
|
|
47a405 |
ret = fn(*args, **kwds)
|
|
|
47a405 |
finally:
|
|
|
47a405 |
- locale.setlocale(locale.LC_MESSAGES, oldlocale)
|
|
|
47a405 |
+ _setlocale(oldlocale)
|
|
|
47a405 |
return ret
|
|
|
47a405 |
return new
|
|
|
47a405 |
--
|
|
|
47a405 |
1.8.1.2
|
|
|
47a405 |
|