File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ def current_thread_id(self):
111111
112112 """
113113
114- if self .greenlet :
114+ if self .greenlet and self . _cache . data :
115115 # Greenlet objects are maintained in a tree structure with
116116 # the 'parent' attribute pointing to that which a specific
117117 # instance is associated with. Only the root node has no
@@ -128,10 +128,9 @@ def current_thread_id(self):
128128 # Unfortunately, instead of returning None, this will segfault
129129 # if attempting to access a non-existent greenlet object.
130130 # https://github.com/python-greenlet/greenlet/blob/master/src/greenlet/TThreadStateCreator.hpp#L57
131- if self ._cache .data :
132- current = self .greenlet .getcurrent ()
133- if current is not None and current .parent :
134- return id (current )
131+ current = self .greenlet .getcurrent ()
132+ if current is not None and current .parent :
133+ return id (current )
135134
136135 if self .asyncio :
137136 task = current_task (self .asyncio )
You can’t perform that action at this time.
0 commit comments