classification
Title: PEP 285 - Adding a bool type
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, loewis
Priority: normal Keywords: patch

Created on 2002-03-10 05:45 by gvanrossum, last changed 2002-04-03 23:04 by gvanrossum. This issue is now closed.

Files
File name Uploaded Description Edit
booldiff.txt gvanrossum, 2002-03-10 05:45 Diffs for bool type (1st upload)
booldiff2.txt gvanrossum, 2002-04-01 02:46 New version (March 31)
booldiff3.txt gvanrossum, 2002-04-03 23:04 Corrected new version (April 2nd). Last one.
Messages (5)
msg39212 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-10 05:45
Here's a preliminary implementation of the PEP,
including unittests  checking the promises made in the
PEP (test_bool.py) and (some) documentation.

With this 12 tests fail for me (on Linux); I'll look
into these later.  They appear shallow (mostly doctests
dying on True or False where 1 or 0 was expected).

Note: the presence of this patch does not mean that the
PEP is accepted -- it just means that a sample
implementation exists in case someone wants to explore
the effects of the PEP on their code.
msg39213 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-01 02:46
Logged In: YES 
user_id=6380

Here's an updated diff (booldiff2.txt). It fixes a refcount
bug in bool_repr(), and works with current CVS.

With this patch set, 10 standard tests fail for shallow
reasons having to do with str() or repr() returning False or
True instead of 0 or 1. Here are the failed tests:

    test_descr test_descrtut test_difflib test_doctest
test_extcall
    test_generators test_gettext test_richcmp
test_richcompare
    test_unicode
msg39214 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-04-01 11:44
Logged In: YES 
user_id=21627

This patch does not support pickling of bools (the PEP
should probably spell out how they are pickled). marshalling
of bools does not round-trip (you get back an int).
msg39215 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-03 20:43
Logged In: YES 
user_id=6380

I've attached a new patch, booldiff3.txt, that solves the
two remaining problems:

- picke, cPickle and marshal roundtrip

- the test suite succeeds (a total of 12 tests had to be
fixed, all because of True/False vs. 1/0 in printed output)

I'm ready to check this in, but I'll first update the PEP.
msg39216 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-03 23:04
Logged In: YES 
user_id=6380

Here's a new version of booldiff.txt that includes the new
files boolobject.[ch] and test_bool.py.  Sorry.
History
Date User Action Args
2002-03-10 05:45:44gvanrossumcreate