Issue1682498

classification
Title: Fix int(None) raising an AttributeError
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, pjenvey
Priority: normal Keywords: patch

Created on 2007-03-17.00:32:23 by pjenvey, last changed 2007-04-17.08:21:43 by cgroves.

Files
File name Uploaded Description Edit Remove
int_attributeerror-2.3_r3142.diff pjenvey, 2007-03-17.00:32:23 int() fix for 2.3 branch against r3142
Messages
msg2688 (view) Author: Philip Jenvey (pjenvey) Date: 2007-03-17.00:32:23
int() on None or any object that doesn't implement __int__ currently raises an AttributeError, when it should raise a TypeError:

Jython 2.3a0 on java1.5.0_07
Type "copyright", "credits" or "license" for more information.
>>> int(None)
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: __int__

Python 2.4.3 (#1, Mar  2 2007, 22:22:33) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> int(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: int() argument must be a string or a number

The following patch fixes this and ensures so with 2 new tests added to test_descr.py
msg2689 (view) Author: Charlie Groves (cgroves) Date: 2007-04-17.06:53:34
Applied to trunk in r3158.
msg2690 (view) Author: Charlie Groves (cgroves) Date: 2007-04-17.08:21:43
Added to 2.3 branch in r3161.
History
Date User Action Args
2007-03-17 00:32:23pjenveycreate