mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-17 01:20:32 +03:00
Decref the ssl module after importing
This commit is contained in:
parent
f635547ec6
commit
c73c1c5771
|
@ -234,13 +234,16 @@ psyco_register_type(PyObject *self, PyObject *args)
|
||||||
static void
|
static void
|
||||||
psyco_libcrypto_threads_init(void)
|
psyco_libcrypto_threads_init(void)
|
||||||
{
|
{
|
||||||
|
PyObject *m;
|
||||||
|
|
||||||
/* importing the ssl module sets up Python's libcrypto callbacks */
|
/* importing the ssl module sets up Python's libcrypto callbacks */
|
||||||
if (PyImport_ImportModule("ssl") != NULL) {
|
if ((m = PyImport_ImportModule("ssl"))) {
|
||||||
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
|
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
|
||||||
that have already been set up */
|
that have already been set up */
|
||||||
#if PG_VERSION_NUM >= 80400
|
#if PG_VERSION_NUM >= 80400
|
||||||
PQinitOpenSSL(1, 0);
|
PQinitOpenSSL(1, 0);
|
||||||
#endif
|
#endif
|
||||||
|
Py_DECREF(m);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* might mean that Python has been compiled without OpenSSL support,
|
/* might mean that Python has been compiled without OpenSSL support,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user