Migrated from PyCObject_{As,From}VoidPtr to PyCapsule, in support of python3.x