]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129430: Make walking vm regions more efficient in MacOS (#129494)
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Fri, 31 Jan 2025 14:08:48 +0000 (14:08 +0000)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2025 14:08:48 +0000 (14:08 +0000)
Modules/_testexternalinspection.c

index 5a28c0e266226b0cc45fcf88f264f1319d54dab5..22074c81b7405f3694751ba85f24b8038c2ce402 100644 (file)
@@ -232,15 +232,15 @@ search_map_for_section(pid_t pid, const char* secname, const char* substr) {
                    &count,
                    &object_name) == KERN_SUCCESS)
     {
-        int path_len = proc_regionfilename(
-            pid, address, map_filename, MAXPATHLEN);
-        if (path_len == 0) {
+        if ((region_info.protection & VM_PROT_READ) == 0
+            || (region_info.protection & VM_PROT_EXECUTE) == 0) {
             address += size;
             continue;
         }
 
-        if ((region_info.protection & VM_PROT_READ) == 0
-            || (region_info.protection & VM_PROT_EXECUTE) == 0) {
+        int path_len = proc_regionfilename(
+            pid, address, map_filename, MAXPATHLEN);
+        if (path_len == 0) {
             address += size;
             continue;
         }