Apply PyObject.patch correcting the return type of several functions

Author: wsanchez
Reviewer: exarkun
Fixes: #2018311

diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c
index d4fc882..d239a3b 100644
--- a/src/crypto/crypto.c
+++ b/src/crypto/crypto.c
@@ -592,7 +592,7 @@
     if (py_pkey) {
 	py_pkey->initialized = 0;
     }
-    return py_pkey;
+    return (PyObject *)py_pkey;
 }
 
 static char crypto_X509Extension_doc[] = "\n\
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index bf50ed2..cc56c2c 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -323,7 +323,7 @@
     if (py_pkey != NULL) {
 	py_pkey->only_public = 1;
     }
-    return py_pkey;
+    return (PyObject *)py_pkey;
 }
 
 static char crypto_X509_set_pubkey_doc[] = "\n\
diff --git a/src/crypto/x509req.c b/src/crypto/x509req.c
index 4c6acd2..f367360 100644
--- a/src/crypto/x509req.c
+++ b/src/crypto/x509req.c
@@ -70,7 +70,7 @@
     if (py_pkey != NULL) {
 	py_pkey->only_public = 1;
     }
-    return py_pkey;
+    return (PyObject *)py_pkey;
 }
 
 static char crypto_X509Req_set_pubkey_doc[] = "\n\