[Patches] [ python-Patches-559288 ] Use builtin boolean if present

SourceForge.net noreply@sourceforge.net
Wed, 22 Jan 2003 07:29:34 -0800


Patches item #559288, was opened at 2002-05-22 12:34
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=559288&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
>Assigned to: Martin v. Löwis (loewis)
Summary: Use builtin boolean if present

Initial Comment:
Now that Python has a boolean type, perhaps xmlrpclib 
should use it if available.  Here's a patch that (I think) 
does what's necessary.  The existing test case (which 
does manipulate a boolean) passes.  Haven't tested it 
with a pre-bool version of Python though.

Skip


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

>Comment By: Skip Montanaro (montanaro)
Date: 2003-01-22 09:29

Message:
Logged In: YES 
user_id=44345

Here's a new version.  I think there may still be problems related to 2.2
(see the dump_bool method), but it should be better w.r.t. 2.1 and earlier
versions.  I'd really like to see this get into 2.3.

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-10-07 16:44

Message:
Logged In: YES 
user_id=21627

I think xmlrpclib.{True,False} must stay, even though they 
could become aliases for the builtin True and False (notice 
that you can access True with bool(1))

The module must stay 1.5.2 compatible, I think this is 
currently not the case: dispatching is based on the type, but 
type(True) will be ClassType in 1.5.2.

The test looks for True to determine presence of the boolean 
type; this is incorrect: Python 2.2 has True without having 
bool. The test also binds x without reason. I'd suggest 

try:
  boolean = bool
except:
   ...

instead

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

Comment By: Skip Montanaro (montanaro)
Date: 2002-08-02 12:03

Message:
Logged In: YES 
user_id=44345

updated patch which avoids using types.BooleanType since there was so 
much pushback on the idea.


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

Comment By: Skip Montanaro (montanaro)
Date: 2002-05-22 12:46

Message:
Logged In: YES 
user_id=44345

new patch - don't know why running the test suite didn't catch
the NameError...


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

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