[Patches] [ python-Patches-724135 ] remove tiny anomaly re bool()

SourceForge.net noreply@sourceforge.net
Sat, 19 Apr 2003 11:15:16 -0700


Patches item #724135, was opened at 2003-04-19 05:40
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=724135&group_id=5470

Category: Core (C code)
Group: Python 2.3
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Alex Martelli (aleax)
Assigned to: Guido van Rossum (gvanrossum)
Summary: remove tiny anomaly re bool()

Initial Comment:
builtin types called without arguments -- int(), long(), float(), 
list(), dict(), tuple() -- return the false value of that type.  
bool() called without arguments raises an exception 
instead.  This patch makes bool behave like the other builtin 
types, and adds tests for this "call type without arguments" 
behavior (for bool AND the other six builtin types).

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-19 14:15

Message:
Logged In: YES 
user_id=6380

Checked in.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-19 14:08

Message:
Logged In: YES 
user_id=6380

I'll check this in, because I like the idea.

I note there's a flaw in the execution: after
  ok = (x != NULL) && PyObject_IsTrue(x);
the following line
  if (ok < 0)
makes no sense; C's && doesn't work like Python's 'and', it
always returns either 0 or 1.

I'll fix this.

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

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