Skip to content

Commit c469bb7

Browse files
author
stroeder
committed
more fine-grained GIL releasing in function l_ldap_result4()
1 parent fae6038 commit c469bb7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released 2.4.44 2017-09-xx
44
Changes since 2.4.43:
55

66
Modules/
7-
*
7+
* more fine-grained GIL releasing in function l_ldap_result4()
88

99
Lib/
1010
*
@@ -1510,4 +1510,4 @@ Released 2.0.0pre02 2002-02-01
15101510
----------------------------------------------------------------
15111511
Released 1.10alpha3 2000-09-19
15121512

1513-
$Id: CHANGES,v 1.464 2017/09/07 09:01:01 stroeder Exp $
1513+
$Id: CHANGES,v 1.465 2017/09/07 09:03:00 stroeder Exp $

Modules/LDAPObject.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* See https://www.python-ldap.org/ for details.
2-
* $Id: LDAPObject.c,v 1.96 2017/08/15 16:21:59 stroeder Exp $ */
2+
* $Id: LDAPObject.c,v 1.97 2017/09/07 09:03:00 stroeder Exp $ */
33

44
#include "common.h"
55
#include "patchlevel.h"
@@ -1024,7 +1024,6 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
10241024
int result = LDAP_SUCCESS;
10251025
char **refs = NULL;
10261026
LDAPControl **serverctrls = 0;
1027-
LDAP_BEGIN_ALLOW_THREADS( self );
10281027
if (res_type == LDAP_RES_SEARCH_ENTRY) {
10291028
/* LDAPmessage_to_python will parse entries and read the controls for each entry */
10301029
} else if (res_type == LDAP_RES_SEARCH_REFERENCE) {
@@ -1035,18 +1034,21 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
10351034
int rc;
10361035
if (res_type == LDAP_RES_EXTENDED) {
10371036
struct berval *retdata = 0;
1037+
LDAP_BEGIN_ALLOW_THREADS( self );
10381038
rc = ldap_parse_extended_result( self->ldap, msg, &retoid, &retdata, 0 );
1039+
LDAP_END_ALLOW_THREADS( self );
10391040
/* handle error rc!=0 here? */
10401041
if (rc == LDAP_SUCCESS) {
10411042
valuestr = LDAPberval_to_object(retdata);
10421043
}
10431044
ber_bvfree( retdata );
10441045
}
10451046

1047+
LDAP_BEGIN_ALLOW_THREADS( self );
10461048
rc = ldap_parse_result( self->ldap, msg, &result, NULL, NULL, &refs,
10471049
&serverctrls, 0 );
1050+
LDAP_END_ALLOW_THREADS( self );
10481051
}
1049-
LDAP_END_ALLOW_THREADS( self );
10501052

10511053
if (result != LDAP_SUCCESS) { /* result error */
10521054
char *e, err[1024];
@@ -1061,7 +1063,9 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
10611063

10621064
if (!(pyctrls = LDAPControls_to_List(serverctrls))) {
10631065
int err = LDAP_NO_MEMORY;
1066+
LDAP_BEGIN_ALLOW_THREADS( self );
10641067
ldap_set_option(self->ldap, LDAP_OPT_ERROR_NUMBER, &err);
1068+
LDAP_END_ALLOW_THREADS( self );
10651069
ldap_msgfree(msg);
10661070
return LDAPerror(self->ldap, "LDAPControls_to_List");
10671071
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy