diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2025-04-25 18:43:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 17:43:32 +0000 |
commit | a5e628beb8592d938209a09e84d072bb5f57d042 (patch) | |
tree | 89c6a32981aaa5206025561718c3605f8c788f0a /Modules | |
parent | a1f4a6b246ada368cb77c7245dfd7f5ccb6f7d87 (diff) | |
download | cpython-a5e628beb8592d938209a09e84d072bb5f57d042.tar.gz cpython-a5e628beb8592d938209a09e84d072bb5f57d042.zip |
gh-91048: Prevent optimizing away the asyncio debug offsets structure on Windows (#132963)
To avoid having the debug sections being optimised away by the compiler
we use __attribute__((used)) on gcc and clang but in Windows this is
not supported by the Microsoft compiler and there is no equivalent flag.
Unfortunately Windows offers almost no alternative other than exporting
the symbol in the dynamic table or using it somehow.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 27e6e67e3c9..5f9181395c4 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -185,6 +185,10 @@ typedef struct { /* Counter for autogenerated Task names */ uint64_t task_name_counter; + /* Pointer to the asyncio debug offset to avoid it to be optimized away + by the compiler */ + void *debug_offsets; + } asyncio_state; static inline asyncio_state * @@ -4320,6 +4324,8 @@ module_init(asyncio_state *state) goto fail; } + state->debug_offsets = &_AsyncioDebug; + Py_DECREF(module); return 0; |