diff --git a/CHANGES b/CHANGES index 3b0bbe0..d5b66df 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,8 @@ Lib/ Modules/ * Fixed checking for empty server error message (thanks to Bradley Baetz) +* Fixed releasing GIL when calling ldap_start_tls_s() + (thanks to Lars Munch) ---------------------------------------------------------------- Released 2.4.28 2016-11-17 @@ -1308,4 +1310,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.400 2017/01/06 15:11:14 stroeder Exp $ +$Id: CHANGES,v 1.401 2017/01/25 19:41:31 stroeder Exp $ diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index 10f166a..a0ab8c6 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -1,5 +1,5 @@ /* See http://www.python-ldap.org/ for details. - * $Id: LDAPObject.c,v 1.94 2016/01/26 11:01:08 stroeder Exp $ */ + * $Id: LDAPObject.c,v 1.95 2017/01/25 19:41:31 stroeder Exp $ */ #include "common.h" #include "patchlevel.h" @@ -1213,14 +1213,16 @@ l_ldap_whoami_s( LDAPObject* self, PyObject* args ) static PyObject* l_ldap_start_tls_s( LDAPObject* self, PyObject* args ) { - int result; + int ldaperror; if (!PyArg_ParseTuple( args, "" )) return NULL; if (not_valid(self)) return NULL; - result = ldap_start_tls_s( self->ldap, NULL, NULL ); - if ( result != LDAP_SUCCESS ){ - ldap_set_option(self->ldap, LDAP_OPT_ERROR_NUMBER, &result); + LDAP_BEGIN_ALLOW_THREADS( self ); + ldaperror = ldap_start_tls_s( self->ldap, NULL, NULL ); + LDAP_END_ALLOW_THREADS( self ); + if ( ldaperror != LDAP_SUCCESS ){ + ldap_set_option(self->ldap, LDAP_OPT_ERROR_NUMBER, &ldaperror); return LDAPerror( self->ldap, "ldap_start_tls_s" ); }