Fix type definitions, module init return values, and unicode/bytes conversions
diff --git a/OpenSSL/crypto/x509name.c b/OpenSSL/crypto/x509name.c
index 83f3c21..7cb7fed 100644
--- a/OpenSSL/crypto/x509name.c
+++ b/OpenSSL/crypto/x509name.c
@@ -152,7 +152,11 @@
 {
     int nid, len;
     char *utf8string;
-    char *name = _PyUnicode_AsString(nameobj);
+    char *name;
+#ifdef PY3
+    nameobj = PyUnicode_AsASCIIString(nameobj);
+#endif
+    name = PyBytes_AsString(nameobj);
 
     if ((nid = OBJ_txt2nid(name)) == NID_undef) {
         /*
@@ -456,7 +460,7 @@
 #undef ADD_METHOD
 
 PyTypeObject crypto_X509Name_Type = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    PyOpenSSL_HEAD_INIT(&PyType_Type, 0)
     "X509Name",
     sizeof(crypto_X509NameObj),
     0,