8000 WIN: Fix capsule check for SetForegroundWindow · matplotlib/matplotlib@db47898 · GitHub
[go: up one dir, main page]

Skip to content

Commit db47898

Browse files
committed
WIN: Fix capsule check for SetForegroundWindow
Looking at pybind11 again, the `py::capsule::name` method returns a `const char *`, and comparing that with a literal using `==` is unspecified behaviour. Seemingly, this is fine on MSVC, but MinGW gcc warns about it.
1 parent 1dea2df commit db47898

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/_c_internal_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void
125125
mpl_SetForegroundWindow(py::capsule UNUSED_ON_NON_WINDOWS(handle_p))
126126
{
127127
#ifdef _WIN32
128-
if (handle_p.name() != "HWND") {
128+
if (strcmp(handle_p.name(), "HWND") != 0) {
129129
throw std::runtime_error("Handle must be a value returned from Win32_GetForegroundWindow");
130130
}
131131
HWND handle = static_cast<HWND>(handle_p.get_pointer());

0 commit comments

Comments
 (0)
0