Skip to content

Commit

Permalink
Document that bytes_strictness is ignored on Python 3.
Browse files Browse the repository at this point in the history
Thi is done to better support programs compatible with both py2 and py3.
  • Loading branch information
Petr Viktorin committed Feb 12, 2018
1 parent 1b17e85 commit ef0c514
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Doc/bytes_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ Errors, warnings, and automatic encoding
----------------------------------------

While the type of values *returned* from python-ldap is always given by
``bytes_mode``, the behavior for “wrong-type” values *passed in* can be
controlled by the ``bytes_strictness`` argument to :func:`ldap.initialize`:
``bytes_mode``, for Python 2 the behavior for “wrong-type” values *passed in*
can be controlled by the ``bytes_strictness`` argument to
:func:`ldap.initialize`:

``bytes_strictness='error'`` (default if ``bytes_mode`` is specified):
A ``TypeError`` is raised.
Expand All @@ -82,6 +83,9 @@ controlled by the ``bytes_strictness`` argument to :func:`ldap.initialize`:
``bytes_strictness='silent'``:
The value is automatically encoded/decoded using the UTF-8 encoding.

On Python 3, ``bytes_strictness`` is ignored and a ``TypeError`` is always
raised.

When setting ``bytes_strictness``, an explicit value for ``bytes_mode`` needs
to be given as well.

Expand Down

0 comments on commit ef0c514

Please sign in to comment.