diff --git a/doc/runtime.rst b/doc/runtime.rst
index d6999f0d1845520ceb7d0fc2d4521145e04a97ea..b809211b86a89fe8d54373b335f9cc54eaa1b69a 100644
--- a/doc/runtime.rst
+++ b/doc/runtime.rst
@@ -78,6 +78,12 @@ Platforms, Devices and Contexts
         Return a list of devices matching *device_type*.
         See :class:`device_type` for values of *device_type*.
 
+        .. versionchanged:: 2013.2
+
+            This used to raise an exception if no matching
+            devices were found. Now, it will simply return
+            an empty list.
+
     .. automethod:: from_int_ptr
     .. autoattribute:: int_ptr
 
diff --git a/src/wrapper/wrap_cl.hpp b/src/wrapper/wrap_cl.hpp
index dbdced1a8fd0e1b880b6c61214ed20c946421d4b..ea1cea822cf3efaf2ff8ed73f5febb8db3fed7a0 100644
--- a/src/wrapper/wrap_cl.hpp
+++ b/src/wrapper/wrap_cl.hpp
@@ -850,6 +850,8 @@ namespace pyopencl
     cl_uint num_devices = 0;
     PYOPENCL_CALL_GUARDED(clGetDeviceIDs,
         (m_platform, devtype, 0, 0, &num_devices));
+    if (num_devices == 0)
+      return py::list();
 
     std::vector<cl_device_id> devices(num_devices);
     PYOPENCL_CALL_GUARDED(clGetDeviceIDs,