classification
Title: json checks True/False by identity, not boolean value
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: bob.ippolito Nosy List: BreamoreBoy, abki, bob.ippolito, eric.araujo, ezio.melotti, flox, gagenellina, r.david.murray, rhettinger
Priority: normal Keywords: patch

Created on 2009-01-14 05:31 by gagenellina, last changed 2011-10-27 15:51 by eric.araujo.

Files
File name Uploaded Description Edit
json.diff gagenellina, 2009-01-14 05:48 patch for json package
Messages (5)
msg79832 - (view) Author: Gabriel Genellina (gagenellina) Date: 2009-01-14 05:31
json compares arguments against True/False by identity, not by boolean 
value; by example:

    if (skipkeys is False and ensure_ascii is True and
        check_circular is True and allow_nan is True ...

Using `ensure_ascii=1` won't work as intended. I don't see the reason 
to check those values by identity - they *are* boolean flags, and 
should be checked by value, as the usual practice.

The attached patch fixes the code and documentation (and a bug encoding 
True/False as keys, including unit tests)
msg108719 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-06-26 12:33
As a patch has been provided can't this be moved forward?  The Python versions also need updating.
msg108749 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-06-26 20:19
Most likely we are waiting for Bob's review.  Have you tested the patch?
msg109175 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-07-03 11:02
Successfully ran test_json for Python 2.6.5 on Windows Vista.
msg146498 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-27 15:51
I agree with the request.  I don’t know if this behavior change can go into stable versions; Raymond will decide, as Bob seems to have retired from the maintenance of stdlib json.
History
Date User Action Args
2011-10-27 15:51:37eric.araujosetnosy: + rhettinger, ezio.melotti, eric.araujo
messages: + msg146498
2011-10-26 18:04:31floxsetnosy: + flox

versions: + Python 3.3, - Python 2.6, Python 3.1
2011-10-26 16:52:02abkisetnosy: + abki
2010-07-03 11:03:54BreamoreBoysetmessages: + msg109175
2010-06-26 20:19:26r.david.murraysetversions: + Python 3.2, - Python 3.0
nosy: + r.david.murray

messages: + msg108749

stage: patch review
2010-06-26 12:33:31BreamoreBoysetnosy: + BreamoreBoy
messages: + msg108719
2009-01-14 17:35:02benjamin.petersonsetassignee: bob.ippolito
nosy: + bob.ippolito
2009-01-14 05:48:06gagenellinasetfiles: + json.diff
keywords: + patch
2009-01-14 05:31:37gagenellinacreate