Skip to content

Commit 0c6d462

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 e75c24d commit 0c6d462

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`` 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
@@ -17,7 +17,7 @@ l_ldap_initialize(PyObject *unused, PyObject *args)
1717
int ret;
1818
PyThreadState *save;
1919

20-
if (!PyArg_ParseTuple(args, "s:initialize", &uri))
20+
if (!PyArg_ParseTuple(args, "z:initialize", &uri))
2121
return NULL;
2222

2323
save = PyEval_SaveThread();

0 commit comments

Comments
 (0)