ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject incubator-ariatosca git commit: ARIA-60 Fix use of thread locals in parser context
Date Sun, 15 Jan 2017 14:46:18 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master dac4da7f6 -> 61b7094d8


ARIA-60 Fix use of thread locals in parser context


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/61b7094d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/61b7094d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/61b7094d

Branch: refs/heads/master
Commit: 61b7094d8fbd7cd34cebc14ab7cd537386143e57
Parents: dac4da7
Author: Tal Liron <tal.liron@gmail.com>
Authored: Sun Jan 15 16:45:35 2017 +0200
Committer: Ran Ziv <ran@gigaspaces.com>
Committed: Sun Jan 15 16:46:05 2017 +0200

----------------------------------------------------------------------
 aria/parser/consumption/context.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/61b7094d/aria/parser/consumption/context.py
----------------------------------------------------------------------
diff --git a/aria/parser/consumption/context.py b/aria/parser/consumption/context.py
index 8fb9bb6..a8b75df 100644
--- a/aria/parser/consumption/context.py
+++ b/aria/parser/consumption/context.py
@@ -24,6 +24,9 @@ from ..modeling import ModelingContext
 from .style import Style
 
 
+_thread_locals = threading.local()
+
+
 class ConsumptionContext(object):
     """
     Properties:
@@ -44,8 +47,7 @@ class ConsumptionContext(object):
         Gets the context attached to the current thread if there is one.
         """
 
-        thread_locals = threading.local()
-        return getattr(thread_locals, 'aria_consumption_context', None)
+        return getattr(_thread_locals, 'aria_consumption_context', None)
 
     def __init__(self, set_thread_local=True):
         self.args = []
@@ -65,8 +67,7 @@ class ConsumptionContext(object):
         Attaches this context to the current thread.
         """
 
-        thread_locals = threading.local()
-        thread_locals.aria_consumption_context = self
+        _thread_locals.aria_consumption_context = self
 
     def write(self, string):
         """


Mime
View raw message