Repository navigation
gh-91048: Prevent optimizing away the asyncio debug offsets structure on Windows #132963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
… on Windows 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.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,6 +185,12 @@ typedef struct { | |
| /* Counter for autogenerated Task names */ | ||
| uint64_t task_name_counter; | ||
|
|
||
| #ifdef MS_WINDOWS | ||
| /* Pointer to the asyncio debug offset to avoid it to be optimized away | ||
| by the compiler in Windows (other platforms don't need this) */ | ||
| void *debug_offsets; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then we'd even do not need the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I still prefer to keep it |
||
| #endif | ||
|
pablogsal marked this conversation as resolved.
Outdated
|
||
|
|
||
| } asyncio_state; | ||
|
|
||
| static inline asyncio_state * | ||
|
|
@@ -4320,6 +4326,10 @@ module_init(asyncio_state *state) | |
| goto fail; | ||
| } | ||
|
|
||
| #ifdef MS_WINDOWS | ||
|
pablogsal marked this conversation as resolved.
Outdated
|
||
| state->debug_offsets = &_AsyncioDebug; | ||
| #endif | ||
|
|
||
|
pablogsal marked this conversation as resolved.
Outdated
|
||
| Py_DECREF(module); | ||
| return 0; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.