From e1703e34c0306f02c1510dd221d50edf5c45020c Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Thu, 10 Dec 2015 08:50:19 -0600
Subject: [PATCH] Fix link if Event.set_callback unsupported, XFail related
 test on windows

---
 src/c_wrapper/event.cpp | 6 ++++--
 test/test_wrapper.py    | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/c_wrapper/event.cpp b/src/c_wrapper/event.cpp
index 316b0810..d75c3a32 100644
--- a/src/c_wrapper/event.cpp
+++ b/src/c_wrapper/event.cpp
@@ -221,11 +221,11 @@ event__wait(clobj_t evt)
         });
 }
 
-#if PYOPENCL_CL_VERSION >= 0x1010 && defined(PYOPENCL_HAVE_EVENT_SET_CALLBACK)
 
 error*
 event__set_callback(clobj_t _evt, cl_int type, void *pyobj)
 {
+#if PYOPENCL_CL_VERSION >= 0x1010 && defined(PYOPENCL_HAVE_EVENT_SET_CALLBACK)
     auto evt = static_cast<event*>(_evt);
     return c_handle_error([&] {
             pyobj = py::ref(pyobj);
@@ -238,8 +238,10 @@ event__set_callback(clobj_t _evt, cl_int type, void *pyobj)
                 py::deref(pyobj);
             }
         });
-}
+#else
+    PYOPENCL_UNSUPPORTED(clSetEventCallback, "CL 1.0 and below and Windows")
 #endif
+}
 
 // Nanny Event
 void*
diff --git a/test/test_wrapper.py b/test/test_wrapper.py
index 063071ba..e7f86c2e 100644
--- a/test/test_wrapper.py
+++ b/test/test_wrapper.py
@@ -792,6 +792,10 @@ def test_program_valued_get_info(ctx_factory):
 
 
 def test_event_set_callback(ctx_factory):
+    import sys
+    if sys.platform.startswith("win"):
+        pytest.xfail("Event.set_callback not present on Windows")
+
     ctx = ctx_factory()
     queue = cl.CommandQueue(ctx)
 
-- 
GitLab