Skip to content

Commit 234f245

Browse files
committed
Use importlib.resources to locate flamegraph assets
1 parent 7c4d792 commit 234f245

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/profiling/sampling/stack_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import base64
22
import collections
33
import functools
4+
import importlib.resources
45
import json
56
import linecache
67
import os
7-
import pathlib
88

99
from .collector import Collector
1010

@@ -209,7 +209,7 @@ def _get_source_lines(self, func):
209209
def _create_flamegraph_html(self, data):
210210
data_json = json.dumps(data)
211211

212-
template_dir = pathlib.Path(__file__).parent
212+
template_dir = importlib.resources.files(__package__)
213213
vendor_dir = template_dir / "_vendor"
214214
assets_dir = template_dir / "_assets"
215215

0 commit comments

Comments
 (0)