]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-136669: build `_asyncio` as static module (#136670)
authorKumar Aditya <kumaraditya@python.org>
Wed, 16 Jul 2025 16:39:08 +0000 (22:09 +0530)
committerGitHub <noreply@github.com>
Wed, 16 Jul 2025 16:39:08 +0000 (22:09 +0530)
`_asyncio` is now built as a static module so that thread states can be accessed directly via registers and avoids the overhead of function call.

Misc/NEWS.d/next/Library/2025-07-15-16-37-34.gh-issue-136669.Yexwah.rst [new file with mode: 0644]
Modules/Setup.stdlib.in
Modules/_remote_debugging_module.c

diff --git a/Misc/NEWS.d/next/Library/2025-07-15-16-37-34.gh-issue-136669.Yexwah.rst b/Misc/NEWS.d/next/Library/2025-07-15-16-37-34.gh-issue-136669.Yexwah.rst
new file mode 100644 (file)
index 0000000..0d93397
--- /dev/null
@@ -0,0 +1 @@
+:mod:`!_asyncio` is now statically linked for improved performance.
index 3a38a60a152e8c59e2d09d5930f8717d8eb86006..86c8eb27c0a6c76e15f13f7976c8fe9efdbd976d 100644 (file)
@@ -32,7 +32,6 @@
 ############################################################################
 # Modules that should always be present (POSIX and Windows):
 @MODULE_ARRAY_TRUE@array arraymodule.c
-@MODULE__ASYNCIO_TRUE@_asyncio _asynciomodule.c
 @MODULE__BISECT_TRUE@_bisect _bisectmodule.c
 @MODULE__CSV_TRUE@_csv _csv.c
 @MODULE__HEAPQ_TRUE@_heapq _heapqmodule.c
 # Limited API template modules; must be built as shared modules.
 @MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c
 @MODULE_XXLIMITED_35_TRUE@xxlimited_35 xxlimited_35.c
+
+
+# for performance
+*static*
+
+@MODULE__ASYNCIO_TRUE@_asyncio _asynciomodule.c
index d72031137e0a4ec59b8def58112ac2b625f6f433..b50e5e403a1a193404c361aec4e23a5f8370fbde 100644 (file)
@@ -811,7 +811,7 @@ _Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
     }
 #elif defined(__linux__)
     // On Linux, search for asyncio debug in executable or DLL
-    address = search_linux_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
+    address = search_linux_map_for_section(handle, "AsyncioDebug", "python");
     if (address == 0) {
         // Error out: 'python' substring covers both executable and DLL
         PyObject *exc = PyErr_GetRaisedException();
@@ -820,10 +820,10 @@ _Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
     }
 #elif defined(__APPLE__) && TARGET_OS_OSX
     // On macOS, try libpython first, then fall back to python
-    address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
+    address = search_map_for_section(handle, "AsyncioDebug", "libpython");
     if (address == 0) {
         PyErr_Clear();
-        address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
+        address = search_map_for_section(handle, "AsyncioDebug", "python");
     }
     if (address == 0) {
         // Error out: 'python' substring covers both executable and DLL