(
pid: int, bss: VirtualMap
)
| 31 | |
| 32 | |
| 33 | def 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 | |
| 50 | def scan_core_bss_for_python_version( |
no outgoing calls