[Xapian-tickets] [Xapian] #297: Python bindings `xapian.cvar` raises strange NameError in unexpected circumstances
Xapian
nobody at xapian.org
Fri Sep 26 14:42:56 BST 2008
#297: Python bindings `xapian.cvar` raises strange NameError in unexpected
circumstances
---------------------+------------------------------------------------------
Reporter: exarkun | Owner: olly
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: normal | Blockedby:
Platform: All | Blocking:
---------------------+------------------------------------------------------
This behavior:
{{{
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xapian
>>> issubclass(xapian.cvar, object)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: Unknown C global variable
>>>
}}}
is rather undesirable. This likely stems from the behavior of getting the
`__class__` attribute of `xapian.cvar`. It's quite unexpected for
`issubclass` to raise a `NameError` and automated discovery tools which
inspect any object they can find in search of things (for example, a test
discovery tool) don't expect it. `TypeError` is something that's more
commonly raised by `issubclass`. Perhaps that would be a better behavior
here. Or still better, if it could just return `False` (or true, if it's
actually possible to get the right type object to pass as the second
argument), that would be ideal.
--
Ticket URL: <http://trac.xapian.org/ticket/297>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list