Capsule-related changes:
* PyCObject_AsVoidPtr() can now open capsules.  This addresses
  most of the remaining backwards-compatibility concerns about
  the conversion of Python 2.7 from CObjects to capsules.
* CObjects were marked Pending Deprecation.
* Documentation about this pending deprecation was added to
  cobject.h.
* The capsule source files were added to the legacy PC build
  processes.
diff --git a/Objects/cobject.c b/Objects/cobject.c
index c437491..72123f4 100644
--- a/Objects/cobject.c
+++ b/Objects/cobject.c
@@ -9,11 +9,23 @@
 typedef void (*destructor1)(void *);
 typedef void (*destructor2)(void *, void*);
 
+static int cobject_deprecation_warning(void)
+{
+    return PyErr_WarnEx(PyExc_PendingDeprecationWarning,
+        "The CObject type is marked Pending Deprecation in Python 2.7.  "
+        "Please use capsule objects instead.", 1);
+}
+
+
 PyObject *
 PyCObject_FromVoidPtr(void *cobj, void (*destr)(void *))
 {
     PyCObject *self;
 
+    if (cobject_deprecation_warning()) {
+        return NULL;
+    }
+
     self = PyObject_NEW(PyCObject, &PyCObject_Type);
     if (self == NULL)
         return NULL;
@@ -30,6 +42,10 @@
 {
     PyCObject *self;
 
+    if (cobject_deprecation_warning()) {
+        return NULL;
+    }
+
     if (!desc) {
         PyErr_SetString(PyExc_TypeError,
                         "PyCObject_FromVoidPtrAndDesc called with null"
@@ -50,6 +66,10 @@
 PyCObject_AsVoidPtr(PyObject *self)
 {
     if (self) {
+        if (PyCapsule_CheckExact(self)) {
+            const char *name = PyCapsule_GetName(self);
+            return (void *)PyCapsule_GetPointer(self, name);
+        }
         if (self->ob_type == &PyCObject_Type)
             return ((PyCObject *)self)->cobject;
         PyErr_SetString(PyExc_TypeError,