Wrong use of ctypes.GetLastError()
in windows_console.py
#132888
Labels
OS-windows
stdlib
Python modules in the Lib dir
topic-repl
Related to the interactive shell
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
Everywhere ctypes.GetLastError() is used, even though use_last_error is specified
cpython/Lib/_pyrepl/windows_console.py
Line 617 in e1c09ff
This will always return the "swapped" error, as can be seen here
cpython/Modules/_ctypes/callbacks.c
Lines 201 to 222 in e1c09ff
or carefully reading the docs (the code was easier to read for me :)
The rule is easy:
use_last_error=True
implies using ctypes.get_last_error(), which @eryksun has for example explained here: https://discuss.python.org/t/a-ctypes-function-to-list-all-loaded-shared-libraries/36370/10CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: