Hold strong references to keep_alive patients

This fixes #856. Instead of the weakref trick, the internals structure
holds an unordered_map from PyObject* to a vector of references. To
avoid the cost of the unordered_map lookup for objects that don't have
any keep_alive patients, a flag is added to each instance to indicate
whether there is anything to do.
diff --git a/tests/test_call_policies.cpp b/tests/test_call_policies.cpp
index 33a3f15..1527592 100644
--- a/tests/test_call_policies.cpp
+++ b/tests/test_call_policies.cpp
@@ -24,6 +24,13 @@
     Child *returnNullChild() { return nullptr; }
 };
 
+#if !defined(PYPY_VERSION)
+class ParentGC : public Parent {
+public:
+    using Parent::Parent;
+};
+#endif
+
 test_initializer keep_alive([](py::module &m) {
     py::class_<Parent>(m, "Parent")
         .def(py::init<>())
@@ -34,6 +41,11 @@
         .def("returnNullChildKeepAliveChild", &Parent::returnNullChild, py::keep_alive<1, 0>())
         .def("returnNullChildKeepAliveParent", &Parent::returnNullChild, py::keep_alive<0, 1>());
 
+#if !defined(PYPY_VERSION)
+    py::class_<ParentGC, Parent>(m, "ParentGC", py::dynamic_attr())
+        .def(py::init<>());
+#endif
+
     py::class_<Child>(m, "Child")
         .def(py::init<>());
 });