Skip to content

Commit 7eaef74

Browse files
authored
pythongh-129430: Make walking vm regions more efficient in MacOS (python#129494)
1 parent 79f85a0 commit 7eaef74

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/_testexternalinspection.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ search_map_for_section(pid_t pid, const char* secname, const char* substr) {
232232
&count,
233233
&object_name) == KERN_SUCCESS)
234234
{
235-
int path_len = proc_regionfilename(
236-
pid, address, map_filename, MAXPATHLEN);
237-
if (path_len == 0) {
235+
if ((region_info.protection & VM_PROT_READ) == 0
236+
|| (region_info.protection & VM_PROT_EXECUTE) == 0) {
238237
address += size;
239238
continue;
240239
}
241240

242-
if ((region_info.protection & VM_PROT_READ) == 0
243-
|| (region_info.protection & VM_PROT_EXECUTE) == 0) {
241+
int path_len = proc_regionfilename(
242+
pid, address, map_filename, MAXPATHLEN);
243+
if (path_len == 0) {
244244
address += size;
245245
continue;
246246
}

0 commit comments

Comments
 (0)