[issue9510] sqlite3.Warning isnt a subclass of exceptions.Warning

Nick Craig-Wood report at bugs.python.org
Wed Aug 4 15:18:13 CEST 2010


New submission from Nick Craig-Wood <nick at craig-wood.com>:

sqlite3.Warning isnt a subclass of exceptions.Warning

This causes this problem when trying to filter warnings

>>> import sqlite3 as DB
>>> from warnings import filterwarnings
>>> filterwarnings("always", category=DB.Warning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/warnings.py", line 56, in filterwarnings
    assert issubclass(category, Warning), "category must be a Warning subclass"
AssertionError: category must be a Warning subclass
>>> 

Other databases do this correctly, eg

>>> import MySQLdb as DB
>>> from warnings import filterwarnings
>>> filterwarnings("always", category=DB.Warning)
>>>

----------
components: Library (Lib)
files: sqlite3-warning-fix.patch
keywords: patch
messages: 112800
nosy: ncw
priority: normal
severity: normal
status: open
title: sqlite3.Warning isnt a subclass of exceptions.Warning
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file18383/sqlite3-warning-fix.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9510>
_______________________________________


More information about the Python-bugs-list mailing list