This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git


The following commit(s) were added to refs/heads/master by this push:
     new d72782d  Fix thread local context not init in Django and add upload 
command to Makefile (#19)
d72782d is described below

commit d72782dde05c61221eea1bd6f2e98639caeef73d
Author: kezhenxu94 <[email protected]>
AuthorDate: Wed Jun 17 14:06:24 2020 +0800

    Fix thread local context not init in Django and add upload command to 
Makefile (#19)
---
 Makefile                             | 3 +++
 skywalking/trace/context/__init__.py | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index f41794b..3714710 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,9 @@ install: gen
 package: clean gen
        python3 setup.py sdist bdist_wheel
 
+upload-test: package
+       twine upload --repository-url https://test.pypi.org/legacy/ dist/*
+
 clean:
        rm -rf browser common language_agent management profile 
service_mesh_probe
        rm -rf skywalking_python.egg-info dist build
diff --git a/skywalking/trace/context/__init__.py 
b/skywalking/trace/context/__init__.py
index 71beae6..dce8d68 100644
--- a/skywalking/trace/context/__init__.py
+++ b/skywalking/trace/context/__init__.py
@@ -120,6 +120,8 @@ _thread_local.context = None
 
 
 def get_context() -> SpanContext:
+    if not hasattr(_thread_local, 'context'):
+        _thread_local.context = None
     _thread_local.context = _thread_local.context or (SpanContext() if 
agent.connected() else NoopContext())
 
     return _thread_local.context

Reply via email to