diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp
index d013519d1a2b829eb1ffd3131ad8057cf4cffcfc..dc6a3684348d06e0ee5991cd74f5ec01c1ef78f0 100644
--- a/src/wrap_cl.hpp
+++ b/src/wrap_cl.hpp
@@ -3783,6 +3783,15 @@ namespace pyopencl
 
         m_queue.reset();
       }
+
+      // only use for testing/diagnostic/debugging purposes!
+      cl_command_queue queue() const
+      {
+        if (m_queue.is_valid())
+          return m_queue.data();
+        else
+          return nullptr;
+      }
   };
 
   // }}}
diff --git a/src/wrap_cl_part_2.cpp b/src/wrap_cl_part_2.cpp
index 33cc6ce30219b597c9d9698cc6b1d36b2ff35c21..80560bd766ad33539d38e9d21c8c20a1cb2f192a 100644
--- a/src/wrap_cl_part_2.cpp
+++ b/src/wrap_cl_part_2.cpp
@@ -408,6 +408,17 @@ void pyopencl_expose_part_2(py::module &m)
       .def("bind_to_queue", &cls::bind_to_queue,
           py::arg("queue"))
       .DEF_SIMPLE_METHOD(unbind_from_queue)
+
+      // only for diagnostic/debugging/testing purposes!
+      .def_property_readonly("_queue",
+          [](cls const &self) -> py::object
+          {
+            cl_command_queue queue = self.queue();
+            if (queue)
+              return py::cast(new command_queue(queue, true));
+            else
+              return py::none();
+          })
       ;
   }
 
diff --git a/src/wrap_mempool.cpp b/src/wrap_mempool.cpp
index 46845594ec2c48a828bebdbba9f11d5a7cf27092..36f6b41060044172609860a8d3fe51915bf573a0 100644
--- a/src/wrap_mempool.cpp
+++ b/src/wrap_mempool.cpp
@@ -488,6 +488,15 @@ namespace pyopencl {
 
         m_ptr.queue.reset();
       }
+
+      // only use for testing/diagnostic/debugging purposes!
+      cl_command_queue queue() const
+      {
+        if (m_ptr.queue.is_valid())
+          return m_ptr.queue.data();
+        else
+          return nullptr;
+      }
   };
 
   // }}}
@@ -677,6 +686,17 @@ void pyopencl_expose_mempool(py::module &m)
       .def("__hash__", [](cls &self) { return (intptr_t) self.svm_ptr(); })
       .DEF_SIMPLE_METHOD(bind_to_queue)
       .DEF_SIMPLE_METHOD(unbind_from_queue)
+
+      // only for diagnostic/debugging/testing purposes!
+      .def_property_readonly("_queue",
+          [](cls const &self) -> py::object
+          {
+            cl_command_queue queue = self.queue();
+            if (queue)
+              return py::cast(new pyopencl::command_queue(queue, true));
+            else
+              return py::none();
+          })
       ;
   }