Skip to content

Commit 1a3818e

Browse files
authored
Merge pull request real-easypy#12 from kendriu/vast
threadtree: Use thread.uuid instead of thread.parent as a key in _FRAME_SNAPSHOT_REGISTRY
2 parents 62205ce + 3c55557 commit 1a3818e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

easypy/threadtree.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ def start_new_thread(target, *args, **kwargs):
8989
def wrapper(*args, **kwargs):
9090
thread = threading.current_thread()
9191
if not DISABLE_ACROSS_THREADS:
92-
_FRAME_SNAPSHOTS_REGISTRY[parent_thread.ident, thread.ident] = (
93-
create_frame_snapshot(parent_frame, parent_thread)
94-
)
92+
_FRAME_SNAPSHOTS_REGISTRY[parent_thread.uuid, thread.uuid] = create_frame_snapshot(parent_frame, parent_thread)
9593
uuid = get_thread_uuid(thread)
9694
UUIDS_TREE[uuid] = parent_uuid
9795
if _REGISTER_GREENLETS:
@@ -253,7 +251,7 @@ def walk_frames(thread=None, *, across_threads=False):
253251
# The "across threads" feature is disabled using "EASYPY_DISABLE_ACROSS_THREADS" explicitly.
254252
# Breaking the loop.
255253
break
256-
frame = _FRAME_SNAPSHOTS_REGISTRY[thread.parent.ident, thread.ident]
254+
frame = _FRAME_SNAPSHOTS_REGISTRY[thread.parent.uuid, thread.uuid]
257255
thread = thread.parent
258256

259257

tests/test_threadtree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def collect_frames():
2222
def test_walk_frames():
2323
frames = []
2424
event_a = threading.Event()
25-
event_b= threading.Event()
25+
event_b = threading.Event()
2626

2727
def func_b():
2828
nonlocal frames

0 commit comments

Comments
 (0)