diff options
author | Jean-Paul Calderone <exarkun@divmod.com> | 2011-04-18 11:03:46 -0400 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@divmod.com> | 2011-04-18 11:03:46 -0400 |
commit | 57e604a872cb60bb74260ae677fb2cadb0bdbe82 (patch) | |
tree | fce4fafa22d0e207027393d01050ec27d9b5c93c /OpenSSL/crypto | |
parent | dc77b20c86bf0b38a7a082df31a2cedadc81fe00 (diff) | |
parent | aed23585b2cf8577c52566069591c63f359a8e43 (diff) | |
download | pyopenssl-57e604a872cb60bb74260ae677fb2cadb0bdbe82.tar.gz |
A bunch of PyPy fixes
Diffstat (limited to 'OpenSSL/crypto')
-rw-r--r-- | OpenSSL/crypto/crl.c | 17 | ||||
-rw-r--r-- | OpenSSL/crypto/crypto.c | 10 | ||||
-rw-r--r-- | OpenSSL/crypto/netscape_spki.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/pkcs12.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/pkcs7.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/pkey.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/revoked.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/x509.c | 4 | ||||
-rw-r--r-- | OpenSSL/crypto/x509ext.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/x509name.c | 2 | ||||
-rw-r--r-- | OpenSSL/crypto/x509req.c | 3 | ||||
-rw-r--r-- | OpenSSL/crypto/x509store.c | 3 |
12 files changed, 46 insertions, 11 deletions
diff --git a/OpenSSL/crypto/crl.c b/OpenSSL/crypto/crl.c index bc76f22..eec5bcb 100644 --- a/OpenSSL/crypto/crl.c +++ b/OpenSSL/crypto/crl.c @@ -276,12 +276,15 @@ PyTypeObject crypto_CRL_Type = { }; int init_crypto_crl(PyObject *module) { - if (PyType_Ready(&crypto_CRL_Type) < 0) { - return 0; - } + if (PyType_Ready(&crypto_CRL_Type) < 0) { + return 0; + } - if (PyModule_AddObject(module, "CRL", (PyObject *)&crypto_CRL_Type) != 0) { - return 0; - } - return 1; + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_CRL_Type); + if (PyModule_AddObject(module, "CRL", (PyObject *)&crypto_CRL_Type) != 0) { + return 0; + } + return 1; } diff --git a/OpenSSL/crypto/crypto.c b/OpenSSL/crypto/crypto.c index 1e2abc2..a7d8cc2 100644 --- a/OpenSSL/crypto/crypto.c +++ b/OpenSSL/crypto/crypto.c @@ -836,13 +836,21 @@ PyOpenSSL_MODINIT(crypto) { crypto_API[crypto_PKCS7_New_NUM] = (void *)crypto_PKCS7_New; crypto_API[crypto_NetscapeSPKI_New_NUM] = (void *)crypto_NetscapeSPKI_New; c_api_object = PyCObject_FromVoidPtr((void *)crypto_API, NULL); - if (c_api_object != NULL) + if (c_api_object != NULL) { + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&c_api_object); PyModule_AddObject(module, "_C_API", c_api_object); + } #endif crypto_Error = PyErr_NewException("OpenSSL.crypto.Error", NULL, NULL); if (crypto_Error == NULL) goto error; + + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_Error); if (PyModule_AddObject(module, "Error", crypto_Error) != 0) goto error; diff --git a/OpenSSL/crypto/netscape_spki.c b/OpenSSL/crypto/netscape_spki.c index b209fae..9369d50 100644 --- a/OpenSSL/crypto/netscape_spki.c +++ b/OpenSSL/crypto/netscape_spki.c @@ -305,6 +305,9 @@ init_crypto_netscape_spki(PyObject *module) { return 0; } + /* PyModule_AddObject steals a reference + */ + Py_INCREF((PyObject *)&crypto_NetscapeSPKI_Type); if (PyModule_AddObject(module, "NetscapeSPKIType", (PyObject *)&crypto_NetscapeSPKI_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/pkcs12.c b/OpenSSL/crypto/pkcs12.c index 7eed1f5..79047e3 100644 --- a/OpenSSL/crypto/pkcs12.c +++ b/OpenSSL/crypto/pkcs12.c @@ -559,6 +559,9 @@ init_crypto_pkcs12(PyObject *module) { return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_PKCS12_Type); if (PyModule_AddObject(module, "PKCS12Type", (PyObject *)&crypto_PKCS12_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/pkcs7.c b/OpenSSL/crypto/pkcs7.c index a074800..1770f7f 100644 --- a/OpenSSL/crypto/pkcs7.c +++ b/OpenSSL/crypto/pkcs7.c @@ -204,6 +204,9 @@ init_crypto_pkcs7(PyObject *module) { return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_PKCS7_Type); if (PyModule_AddObject(module, "PKCS7Type", (PyObject *)&crypto_PKCS7_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/pkey.c b/OpenSSL/crypto/pkey.c index fd6c735..0a13aa3 100644 --- a/OpenSSL/crypto/pkey.c +++ b/OpenSSL/crypto/pkey.c @@ -259,6 +259,9 @@ init_crypto_pkey(PyObject *module) return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_PKey_Type); if (PyModule_AddObject(module, "PKeyType", (PyObject *)&crypto_PKey_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/revoked.c b/OpenSSL/crypto/revoked.c index e9b1297..93f9946 100644 --- a/OpenSSL/crypto/revoked.c +++ b/OpenSSL/crypto/revoked.c @@ -434,6 +434,9 @@ int init_crypto_revoked(PyObject *module) { return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_Revoked_Type); if (PyModule_AddObject(module, "Revoked", (PyObject *)&crypto_Revoked_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/x509.c b/OpenSSL/crypto/x509.c index 5d2a2e6..a12220b 100644 --- a/OpenSSL/crypto/x509.c +++ b/OpenSSL/crypto/x509.c @@ -883,9 +883,7 @@ init_crypto_x509(PyObject *module) return 0; } - /* PyModule_AddObject steals a reference. We need crypto_X509_Type to - * still be ours at least until the second PyModule_AddObject call - * below. + /* PyModule_AddObject steals a reference. */ Py_INCREF((PyObject *)&crypto_X509_Type); if (PyModule_AddObject(module, "X509", (PyObject *)&crypto_X509_Type) != 0) { diff --git a/OpenSSL/crypto/x509ext.c b/OpenSSL/crypto/x509ext.c index 81d84dd..adbe084 100644 --- a/OpenSSL/crypto/x509ext.c +++ b/OpenSSL/crypto/x509ext.c @@ -324,6 +324,9 @@ init_crypto_x509extension(PyObject *module) return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_X509Extension_Type); if (PyModule_AddObject(module, "X509ExtensionType", (PyObject *)&crypto_X509Extension_Type) != 0) { return 0; diff --git a/OpenSSL/crypto/x509name.c b/OpenSSL/crypto/x509name.c index 422314d..d0dfb91 100644 --- a/OpenSSL/crypto/x509name.c +++ b/OpenSSL/crypto/x509name.c @@ -528,6 +528,8 @@ init_crypto_x509name(PyObject *module) return 0; } + /* PyModule_AddObject steals a reference. + */ Py_INCREF((PyObject *)&crypto_X509Name_Type); if (PyModule_AddObject(module, "X509NameType", (PyObject *)&crypto_X509Name_Type) != 0) { return 0; diff --git a/OpenSSL/crypto/x509req.c b/OpenSSL/crypto/x509req.c index 7489b65..a2d1f11 100644 --- a/OpenSSL/crypto/x509req.c +++ b/OpenSSL/crypto/x509req.c @@ -420,6 +420,9 @@ init_crypto_x509req(PyObject *module) return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_X509Req_Type); if (PyModule_AddObject(module, "X509ReqType", (PyObject *)&crypto_X509Req_Type) != 0) { return 0; } diff --git a/OpenSSL/crypto/x509store.c b/OpenSSL/crypto/x509store.c index c6fa10c..bf22756 100644 --- a/OpenSSL/crypto/x509store.c +++ b/OpenSSL/crypto/x509store.c @@ -138,6 +138,9 @@ init_crypto_x509store(PyObject *module) return 0; } + /* PyModule_AddObject steals a reference. + */ + Py_INCREF((PyObject *)&crypto_X509Store_Type); if (PyModule_AddObject(module, "X509StoreType", (PyObject *)&crypto_X509Store_Type) != 0) { return 0; } |