Add __module__ attribute to all pybind11 builtin types (#729)

Fixes #728.
diff --git a/include/pybind11/class_support.h b/include/pybind11/class_support.h
index 4cd81a1..56abbf8 100644
--- a/include/pybind11/class_support.h
+++ b/include/pybind11/class_support.h
@@ -57,6 +57,8 @@
     if (PyType_Ready(type) < 0)
         pybind11_fail("make_static_property_type(): failure in PyType_Ready()!");
 
+    setattr((PyObject *) type, "__module__", str("pybind11_builtins"));
+
     return type;
 }
 
@@ -170,6 +172,8 @@
     if (PyType_Ready(type) < 0)
         pybind11_fail("make_default_metaclass(): failure in PyType_Ready()!");
 
+    setattr((PyObject *) type, "__module__", str("pybind11_builtins"));
+
     return type;
 }
 
@@ -270,6 +274,8 @@
     if (PyType_Ready(type) < 0)
         pybind11_fail("PyType_Ready failed in make_object_base_type():" + error_string());
 
+    setattr((PyObject *) type, "__module__", str("pybind11_builtins"));
+
     assert(!PyType_HasFeature(type, Py_TPFLAGS_HAVE_GC));
     return (PyObject *) heap_type;
 }
diff --git a/tests/test_modules.py b/tests/test_modules.py
index fe72f19..6962094 100644
--- a/tests/test_modules.py
+++ b/tests/test_modules.py
@@ -52,3 +52,11 @@
 
     assert OD is OrderedDict
     assert str(OD([(1, 'a'), (2, 'b')])) == "OrderedDict([(1, 'a'), (2, 'b')])"
+
+
+def test_pydoc():
+    """Pydoc needs to be able to provide help() for everything inside a pybind11 module"""
+    import pybind11_tests
+    import pydoc
+
+    assert pydoc.text.docmodule(pybind11_tests)