diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx
index 8b3e0553b583459b4d80a2ed06ab401f6bc30c39..423f4bae4e6c5009a1fb25d94757edc83f3ba31d 100644
--- a/rocksdb/_rocksdb.pyx
+++ b/rocksdb/_rocksdb.pyx
@@ -35,6 +35,13 @@ import errors
 cdef extern from "cpp/utils.hpp" namespace "py_rocks":
     cdef const Slice* vector_data(vector[Slice]&)
 
+# Prepare python for threaded usage.
+# Python callbacks (merge, comparator)
+# could be executed in a rocksdb background thread (eg. compaction).
+cdef extern from "Python.h":
+    void PyEval_InitThreads()
+PyEval_InitThreads()
+
 ## Here comes the stuff to wrap the status to exception
 cdef check_status(const Status& st):
     if st.ok():