[Cython] hasattr() swallows any exception (Py<3.2)

Lisandro Dalcin dalcinl at gmail.com
Tue Feb 22 21:41:22 CET 2011

Take a look here: http://bugs.python.org/issue9666

'hasattr' default behaviour should be changed to suppress only
AttributeError exceptions.  Other should pass through.

Should we do something about this in Cython? We currently use
PyObject_HasAttr(), but even in Python 3.2 this is not the same as
builtins.hasattr(), it swallows any exception (do you think this is a
bug in core Python?). I'm inclined to fix the behavior for ALL Python
versions to suppress only AttributeError.

Lisandro Dalcin
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

More information about the cython-devel mailing list