bpo-36965: include windows.h to be able to use STATUS_CONTROL_C_EXIT#13421
bpo-36965: include windows.h to be able to use STATUS_CONTROL_C_EXIT#13421vstinner merged 4 commits intopython:masterfrom
Conversation
Modules/main.c
Outdated
| #ifdef _MSC_VER | ||
| # include <crtdbg.h> /* STATUS_CONTROL_C_EXIT */ | ||
| #ifdef MS_WINDOWS | ||
| # include <winternl.h> /* NTSTATUS */ |
There was a problem hiding this comment.
I don't understand what this include is needed, the file doesn't use NTSTATUS.
There was a problem hiding this comment.
ntstatus.h contains the value of STATUS_CONTROL_C_EXIT, and that value is of type NTSTATUS.
however ntstatus.h does not contain the definition of NTSTATUS and neither does it include that definition. So, only including ntstatus.h will not compile. I found the documentation linked above that specifies that one should include ntdef.h to have the definition of NTSTATUS.
but then again, that seems to have been deprecated, and I found comments in the headers that winternl.h should be used instead of ntdef.h
(I'm not much of a windows developer, so I only tried to parse the available documentation)
|
include statements were changed as discussed in bpo-36965 |
|
Azure Pipelines PR: Windows PR Tests win64 failed with timeout: I close/reopen the PR to schedule a new job. |
|
Thanks @erikjanss for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
Hum, our bot creating backport is broken: python/miss-islington#228 @erikjanss: Can you please try to create manually a PR to backport your fix? |
|
Thanks @erikjanss for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
Sorry, @erikjanss and @vstinner, I could not cleanly backport this to |
The bot first failed with a timeout, but then run correctly, except that there is a merge conflict. @erikjanss: Agai, can you please backport manually the fix? |
|
@vstinner, I'll give the manual backport a try ... |
…ythonGH-13421) Include windows.h rather than crtdbg.h to get STATUS_CONTROL_C_EXIT constant. Moreover, include windows.h on Windows, not only when MSC is used. (cherry picked from commit 925af1d)
…lers (pythonGH-13421) Include windows.h rather than crtdbg.h to get STATUS_CONTROL_C_EXIT constant. Moreover, include windows.h on Windows, not only when MSC is used.. (cherry picked from commit 925af1d) Co-authored-by: Erik Janssens <erik.janssens@conceptive.be>
|
GH-13471 is a backport of this pull request to the 3.7 branch. |
According to the Microsoft documentation at
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values
system-supplied status codes are defined in ntstatus.h. and the NTSTATUS type is defined in ntdef.h
this PR includes both ntstatus.h and ntdef.h to be able to use STATUS_CONTROL_C_EXIT when compiling for windows.
https://bugs.python.org/issue36965