]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Disallow all ambiguous boolean values for Boolean
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 11 Oct 2017 21:56:14 +0000 (17:56 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 12 Oct 2017 17:39:06 +0000 (13:39 -0400)
commitc63658973c95996b73251e0953cf4c598cdb262b
tree1d9aba0b27f2f096369b95cf0a6dbb95f87825ac
parent3306d4d34d0f78bdda6f85a0a3be81beb2850676
Disallow all ambiguous boolean values for Boolean

In release 1.1, the :class:`.Boolean` type was broken in that
boolean coercion via ``bool()`` would occur for backends that did not
feature "native boolean", but would not occur for native boolean backends,
meaning the string ``"0"`` now behaved inconsistently. After a poll, a
consensus was reached that non-boolean values should be raising an error,
especially in the ambiguous case of string ``"0"``; so the :class:`.Boolean`
datatype will now raise ``ValueError`` if an incoming value is not
within the range ``None, True, False, 1, 0``.

Change-Id: If70c4f79c266f0dd1a0306c0ffe7acb9c66c4cc3
Fixes: #4102
doc/build/changelog/migration_12.rst
doc/build/changelog/unreleased_12/4102.rst [new file with mode: 0644]
lib/sqlalchemy/processors.py
lib/sqlalchemy/sql/sqltypes.py
test/engine/test_processors.py
test/sql/test_types.py