Use PyBytes_ for 3.x compatibility
diff --git a/OpenSSL/crypto/x509.c b/OpenSSL/crypto/x509.c
index 4f29b97..9ee28e8 100644
--- a/OpenSSL/crypto/x509.c
+++ b/OpenSSL/crypto/x509.c
@@ -543,7 +543,7 @@
PyErr_SetString(PyExc_ValueError, "Undefined signature algorithm");
return NULL;
}
- return PyString_FromString(OBJ_nid2ln(nid));
+ return PyBytes_FromString(OBJ_nid2ln(nid));
}
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index 1fcb543..55c42f1 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -1486,7 +1486,7 @@
the algorithm used to sign the certificate.
"""
cert = load_certificate(FILETYPE_PEM, self.pemData)
- self.assertEqual(cert.get_signature_algorithm(), "sha1WithRSAEncryption")
+ self.assertEqual(cert.get_signature_algorithm(), b("sha1WithRSAEncryption"))
def test_get_undefined_signature_algorithm(self):