From ef0c5140c7599a4ac02af11dd81c719d8f7b4828 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 12 Feb 2018 11:00:36 +0100 Subject: [PATCH] Document that bytes_strictness is ignored on Python 3. Thi is done to better support programs compatible with both py2 and py3. --- Doc/bytes_mode.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/bytes_mode.rst b/Doc/bytes_mode.rst index 135125f..d7c2aa4 100644 --- a/Doc/bytes_mode.rst +++ b/Doc/bytes_mode.rst @@ -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. @@ -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.