switch x509store initialization over to the module-based api as well
diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c
index 89091cc..2240df0 100644
--- a/src/crypto/crypto.c
+++ b/src/crypto/crypto.c
@@ -628,7 +628,7 @@
{
static void *crypto_API[crypto_API_pointers];
PyObject *c_api_object;
- PyObject *module, *dict;
+ PyObject *module;
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
@@ -662,7 +662,6 @@
PyModule_AddIntConstant(module, "TYPE_RSA", crypto_TYPE_RSA);
PyModule_AddIntConstant(module, "TYPE_DSA", crypto_TYPE_DSA);
- dict = PyModule_GetDict(module);
#ifdef WITH_THREAD
if (!init_openssl_threads())
goto error;
@@ -671,7 +670,7 @@
goto error;
if (!init_crypto_x509name(module))
goto error;
- if (!init_crypto_x509store(dict))
+ if (!init_crypto_x509store(module))
goto error;
if (!init_crypto_x509req(module))
goto error;
diff --git a/src/crypto/x509store.c b/src/crypto/x509store.c
index 6bf1310..9f46029 100644
--- a/src/crypto/x509store.c
+++ b/src/crypto/x509store.c
@@ -128,14 +128,19 @@
/*
* Initialize the X509Store part of the crypto module
*
- * Arguments: dict - The crypto module dictionary
+ * Arguments: module - The crypto module
* Returns: None
*/
int
-init_crypto_x509store(PyObject *dict)
+init_crypto_x509store(PyObject *module)
{
- crypto_X509Store_Type.ob_type = &PyType_Type;
- Py_INCREF(&crypto_X509Store_Type);
- PyDict_SetItemString(dict, "X509StoreType", (PyObject *)&crypto_X509Store_Type);
+ if (PyType_Ready(&crypto_X509Store_Type) < 0) {
+ return 0;
+ }
+
+ if (PyModule_AddObject(module, "X509StoreType", (PyObject *)&crypto_X509Store_Type) != 0) {
+ return 0;
+ }
+
return 1;
}