MCPcopy Create free account
hub / github.com/bloomberg/pystack / scan_process_bss_for_python_version

Function scan_process_bss_for_python_version

src/pystack/process.py:33–47  ·  view source on GitHub ↗
(
    pid: int, bss: VirtualMap
)

Source from the content-addressed store, hash-verified

31
32
33def scan_process_bss_for_python_version(
34 pid: int, bss: VirtualMap
35) -> Optional[Tuple[int, int]]:
36 # Lazy import _pystack to overcome a circular-import
37 # (we really don't want a new extension just for this) :(
38 try:
39 from pystack._pystack import copy_memory_from_address
40 except ImportError: # pragma: no cover
41 return None
42 memory = copy_memory_from_address(pid, bss.start, bss.size)
43 match = BSS_VERSION_REGEXP.findall(memory)
44 if not match:
45 return None
46 ((_, major, minor, patch, *_),) = match
47 return int(major), int(minor)
48
49
50def scan_core_bss_for_python_version(

Calls

no outgoing calls