Skip to content

Commit d84deff

Browse files
committed
Allow passing None as uri argument to ldap.initialize()
OpenLDAP allows passing NULL to ldap_initialize(). In this case the default URI from ldap.conf will be used. Allow passing None as uri argument to ldap.initialize().
1 parent f481010 commit d84deff

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Doc/reference/ldap.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ This module defines the following functions:
3838
The *uri* parameter may be a comma- or whitespace-separated list of URIs
3939
containing only the schema, the host, and the port fields. Note that
4040
when using multiple URIs you cannot determine to which URI your client
41-
gets connected.
41+
gets connected. If *uri* is :py:const:`None`, the default URIs from
42+
``ldap.conf`` or :py:const:`OPT_URI` global option will be used.
4243

4344
If *fileno* parameter is given then the file descriptor will be used to
4445
connect to an LDAP server. The *fileno* must either be a socket file

Modules/functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ l_ldap_initialize(PyObject *unused, PyObject *args)
1212
int ret;
1313
PyThreadState *save;
1414

15-
if (!PyArg_ParseTuple(args, "s:initialize", &uri))
15+
if (!PyArg_ParseTuple(args, "z:initialize", &uri))
1616
return NULL;
1717

1818
save = PyEval_SaveThread();

0 commit comments

Comments
 (0)