[DB-SIG] DbiDate testing for None

Brad Crittenden bac@ivc.com
Tue, 03 Mar 1998 15:10:25 -0500


i recently ran into the problem where testing for None for a DbiDate object
causes a segfault.  i searched the net and found a post on 3/17/97
regarding the problem but have seen no followup.    I'm currently avoiding
the problem by testing "type(x) is not NoneType".  does anyone know of a
solution or better work-around?


problem:  i discovered the segfault problem using filter(None,list) where
an element of list was a DbiDate object. as shown below.  also, "if d:"
causes segfault when d is a DbiDate.

>>> t.cur.execute(sql)
>>> d=t.cur.fetchone()
>>> t.cur.description
[('PKEY', 'NUMBER', 40, 22, 38, 0, 0), ('DATECLOSED', 'DATE', 75, 7, 0, 0, 1)]
>>> d
(16, <DbiDate object at c7058>)
>>> filter(None,d)
Segmentation Fault(coredump)

this happens on solaris using oracledb and on NT4.0 (pythonwin and python)
using odbc.

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org