From a7ba5fb021eaef4e3713b52273b027bbccfa6ec0 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:18:20 +0100 Subject: [PATCH 1/4] Use `as_py_json` from Pyodide 0.29 --- threadpoolctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threadpoolctl.py b/threadpoolctl.py index e6ac58d8..1798a66c 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -1132,7 +1132,7 @@ def _find_libraries_pyodide(self): ) return - for filepath in LDSO.loadedLibsByName.as_object_map(): + for filepath in LDSO.loadedLibsByName.as_py_json(): # Some libraries are duplicated by Pyodide and do not exist in the # filesystem, so we first check for the existence of the file. For # more details, see From 243a55a803405759a3613c4c7d1f754eca725bdb Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:21:52 +0100 Subject: [PATCH 2/4] Add check on `as_py_json` re: Pyodide version --- threadpoolctl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/threadpoolctl.py b/threadpoolctl.py index 1798a66c..b7e86ca6 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -1131,8 +1131,14 @@ def _find_libraries_pyodide(self): "happen." ) return + + if hasattr(LDSO.loadedLibsByName, 'as_py_json'): # Pyodide >= 0.29 + libs_iter = LDSO.loadedLibsByName.as_py_json() + else: + libs_iter = LDSO.loadedLibsByName.as_object_map() # Pyodide < 0.29 + - for filepath in LDSO.loadedLibsByName.as_py_json(): + for filepath in libs_iter: # Some libraries are duplicated by Pyodide and do not exist in the # filesystem, so we first check for the existence of the file. For # more details, see From 14917a4218992bf738ad80723489d1bd9e2b5602 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:59:56 +0100 Subject: [PATCH 3/4] Lint --- threadpoolctl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/threadpoolctl.py b/threadpoolctl.py index b7e86ca6..bbec5847 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -1132,10 +1132,10 @@ def _find_libraries_pyodide(self): ) return - if hasattr(LDSO.loadedLibsByName, 'as_py_json'): # Pyodide >= 0.29 + if hasattr(LDSO.loadedLibsByName, 'as_py_json'): # Pyodide >= 0.29 libs_iter = LDSO.loadedLibsByName.as_py_json() else: - libs_iter = LDSO.loadedLibsByName.as_object_map() # Pyodide < 0.29 + libs_iter = LDSO.loadedLibsByName.as_object_map() # Pyodide < 0.29 for filepath in libs_iter: From cdd1d671f61c0405c8291646715cfaee3d924237 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 7 Nov 2025 11:47:09 +0100 Subject: [PATCH 4/4] Oops lint again --- threadpoolctl.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/threadpoolctl.py b/threadpoolctl.py index bbec5847..ceed5b88 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -1131,13 +1131,12 @@ def _find_libraries_pyodide(self): "happen." ) return - - if hasattr(LDSO.loadedLibsByName, 'as_py_json'): # Pyodide >= 0.29 + + if hasattr(LDSO.loadedLibsByName, "as_py_json"): # Pyodide >= 0.29 libs_iter = LDSO.loadedLibsByName.as_py_json() else: libs_iter = LDSO.loadedLibsByName.as_object_map() # Pyodide < 0.29 - for filepath in libs_iter: # Some libraries are duplicated by Pyodide and do not exist in the # filesystem, so we first check for the existence of the file. For