fw at alioth.debian.org
2008-Nov-23 18:07 UTC
[Secure-testing-commits] r10465 - lib/python
Author: fw Date: 2008-11-23 18:07:13 +0000 (Sun, 23 Nov 2008) New Revision: 10465 Modified: lib/python/bugs.py Log: lib/python/bugs.py: Replace integer type asserts to with int conversion The reason is that even in Python 2.5, numeric objects fluctuate between int and long types. Modified: lib/python/bugs.py ==================================================================--- lib/python/bugs.py 2008-11-23 13:39:12 UTC (rev 10464) +++ lib/python/bugs.py 2008-11-23 18:07:13 UTC (rev 10465) @@ -35,6 +35,11 @@ return None del listUrgencies +def to_integer(expr): + ei = int(expr) + assert ei == expr, expr + return ei + class PackageNote: """A package note. @@ -95,10 +100,10 @@ assert False def loadBugs(self, cursor): - assert type(self.id) == types.IntType, self.id + id = to_integer(self.id) assert len(self.bugs) == 0 for (b,) in cursor.execute\ - ("SELECT bug FROM debian_bugs WHERE note = ?", (self.id,)): + ("SELECT bug FROM debian_bugs WHERE note = ?", (id,)): self.bugs.append(int(b)) def merge(self, other): @@ -184,7 +189,7 @@ def __init__(self, fname, lineno, date, name, description, comments): assert type(fname) in types.StringTypes - assert type(lineno) == types.IntType + lineno = to_integer(lineno) self.source_file = fname self.source_line = lineno self.date = date