Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.13t"
- "3.14"
- "3.14t"
- "pypy3.9"
- "pypy3.10"
- "pypy3.11"
image:
- "ubuntu-22.04"
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tox-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- py311
- py312
- py313
- py314
- py3-nosasltls
- py3-trace
- pypy3
Expand Down
32 changes: 32 additions & 0 deletions Doc/reference/ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,38 @@ These attributes are mutable unless described as read-only.
This option is used in the wrapper module.


.. _ldap-thread-safety:

Thread safety
=============

On platforms that support it, the :py:mod:`_ldap` C extension declares itself
compatible with the free-threaded (no-GIL) CPython builds (`PEP 703`_) and with
per-interpreter GIL.

.. _PEP 703: https://www.python.org/dev/peps/pep-0703/

Caveats to observe:

* Concurrent access to the same connection object is still limited on the Python
side (by a lock).
* While rare now, the underlying library might not be compiled thread-safe
itself. Whether that is the case is detected at runtime and exposed as
:py:data:`ldap.LIBLDAP_R`. If ``0``, it is not safe to use the module across
several concurrent threads. The module does *not* try to change its behaviour
to compensate for this.
* :py:func:`ldap.set_option` sets the global library state and it is shared
across all copies of the module. This is also the state largely inherited by
most :class:`~ldap.ldapobject.LDAPObject` instances on creation. It is advised
users rely on :py:meth:`LDAPObject.set_option` in most circumstances if using
multiple interpreters.

.. versionchanged:: 3.5.0

The :py:mod:`_ldap` extension was ported to the Limited API and as a result
all types belong to the module object they were instantiated with (heap
types). This release is also the first to declare free-threading support.

.. _ldap-example:

Example
Expand Down
2 changes: 1 addition & 1 deletion Misc/python-ldap.supp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
fun:PyObject_Malloc
...
fun:PyErr_NewException
fun:LDAPinit_constants
fun:LDAPMod_init_constants
fun:init_ldap_module
...
}
Loading