Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:openSUSE:Factory:rpmlint
python-logutils
use-logging-lock-directly.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File use-logging-lock-directly.patch of Package python-logutils
Index: logutils-0.3.5/logutils/dictconfig.py =================================================================== --- logutils-0.3.5.orig/logutils/dictconfig.py +++ logutils-0.3.5/logutils/dictconfig.py @@ -290,8 +290,7 @@ class DictConfigurator(BaseConfigurator) raise ValueError("Unsupported version: %s" % config['version']) incremental = config.pop('incremental', False) EMPTY_DICT = {} - logging._acquireLock() - try: + with logging._lock: if incremental: handlers = config.get('handlers', EMPTY_DICT) # incremental handler config only if handler name @@ -430,8 +429,6 @@ class DictConfigurator(BaseConfigurator) e = sys.exc_info()[1] raise ValueError('Unable to configure root ' 'logger: %s' % e) - finally: - logging._releaseLock() def configure_formatter(self, config): """Configure a formatter from a dictionary.""" Index: logutils-0.3.5/tests/test_dictconfig.py =================================================================== --- logutils-0.3.5.orig/tests/test_dictconfig.py +++ logutils-0.3.5/tests/test_dictconfig.py @@ -39,8 +39,7 @@ class ConfigDictTest(unittest.TestCase): self.adapter = LoggerAdapter(l, {}) logger_dict = logging.getLogger().manager.loggerDict - logging._acquireLock() - try: + with logging._lock: self.saved_handlers = logging._handlers.copy() self.saved_handler_list = logging._handlerList[:] self.saved_loggers = logger_dict.copy() @@ -49,8 +48,6 @@ class ConfigDictTest(unittest.TestCase): else: self.saved_level_to_name = logging._levelToName.copy() self.saved_name_to_level = logging._nameToLevel.copy() - finally: - logging._releaseLock() self.root_logger = logging.getLogger("") self.original_logging_level = self.root_logger.getEffectiveLevel() @@ -58,8 +55,7 @@ class ConfigDictTest(unittest.TestCase): def tearDown(self): self.root_logger.setLevel(self.original_logging_level) - logging._acquireLock() - try: + with logging._lock: if hasattr(logging, '_levelNames'): logging._levelNames.clear() logging._levelNames.update(self.saved_level_names) @@ -74,8 +70,6 @@ class ConfigDictTest(unittest.TestCase): loggerDict = logging.getLogger().manager.loggerDict loggerDict.clear() loggerDict.update(self.saved_loggers) - finally: - logging._releaseLock() message_num = 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor