[Patches] [ python-Patches-528022 ] PEP 285 - Adding a bool type

noreply@sourceforge.net noreply@sourceforge.net
Wed, 03 Apr 2002 12:43:47 -0800


Patches item #528022, was opened at 2002-03-10 00:45
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=528022&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: PEP 285 - Adding a bool type

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-04-03 15:43

Message:
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.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-04-01 06:44

Message:
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).

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-31 21:46

Message:
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


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=528022&group_id=5470